-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve construction core dump #39
Comments
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
https://github.com/rigtorp/MPMCQueue/blob/28d05c021d68fc5280b593329d1982ed02f9d7b3/include/rigtorp/MPMCQueue.h#L173
—
Reply to this email directly, view it on GitHub
<#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 <typename T>
struct nothrow_wrapper {
T v;
bool valid;
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
<#39 (comment)>,
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if some class constructor cause some nullptr exception caused core dump. How to resolve this at
MPMCQueue/include/rigtorp/MPMCQueue.h
Line 173 in 28d05c0
The text was updated successfully, but these errors were encountered: