Closed g302ge closed 10 months ago
Constructors must be noexcept: static_assert(std::is_nothrow_constructible<T, Args &&...>::value, "T must be nothrow constructible with Args&&...");
On Thu, Aug 3, 2023 at 11:43 AM George @.***> wrote:
if some class constructor cause some nullptr exception caused core dump. How to resolve this at
— Reply to this email directly, view it on GitHub https://github.com/rigtorp/MPMCQueue/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLO27IX67HQ7TJNNACJM3XTPILFANCNFSM6AAAAAA3DBPG4E . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thx for your reply. But in my view, the constructor must not be noexcept is a very strong safety for the lock free situation. In other words the constructor or some code in the critical section like constructor in this case should be more atomic as they can do. if this view is correct ?
There is no way to unwind a partial enqueue operation unfortunately. This means that constructing the enqeued time cannot fail.
The solution is to mark failed enques and skip them, I didn't want everyone
to pay the cost of this by default. What you can do is create a wrapper
type:
template
nothrow_wrapper(T &&v) { try { this->v = v; valid=true; catch (...) { valid=false; } } }
And then check for valid items when you pop();
However it should always be possible to create a noexcept move constructor.
On Wed, Aug 30, 2023 at 2:39 PM George @.***> wrote:
Thx for your reply. But in my view, the constructor must not be noexcept is a very strong safety for the lock free situation. In other words the constructor or some code in the critical section like constructor in this case should be more atomic as they can do. if this view is correct ?
— Reply to this email directly, view it on GitHub https://github.com/rigtorp/MPMCQueue/issues/39#issuecomment-1699732726, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLO2YOZTEWKOTHE4NMPC3XX6JHVANCNFSM6AAAAAA3DBPG4E . You are receiving this because you commented.Message ID: @.***>
thx for your reply , I have fix my variant version in a safe situation
if some class constructor cause some nullptr exception caused core dump. How to resolve this at
https://github.com/rigtorp/MPMCQueue/blob/28d05c021d68fc5280b593329d1982ed02f9d7b3/include/rigtorp/MPMCQueue.h#L173