You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The atomic boolean is simply used to pool-block for the shutdown callback (which is called from another thread).
The "optimal" way (with no pooling) would be to use a condition variable, but that was a bit overkill for that simple case.
If the bool was not atomic, it would be a data race, and it would in theory be possible (and valid, but unlikely in practice) for the main thread to keep using the CPU-core-cached value 'false' instead of the value 'true' stored by the shutdown callback.
Having many context objects is not a problem: these objects track the state of async operations like listen, get, or shutdown.
There should be one instance per operation performed, unless the user is not interested to know how the async op is doing.
On Wed, 27 Apr 2022 at 23:29, Adrien Béraud ***@***.***> wrote:
The atomic boolean is simply used to pool-block for the shutdown callback (which is called from another thread).
The "optimal" way (with no pooling) would be to use a condition variable, but that was a bit overkill for that simple case.
If the bool was not atomic, it would be a data race, and it would in theory be possible (and valid, but unlikely in practice) for the main thread to keep using the CPU-core-cached value 'false' instead of the value 'true' stored by the shutdown callback.
Having many context objects is not a problem: these objects track the state of async operations like listen, get, or shutdown.
There should be one instance per operation performed, unless the user is not interested to know how the async op is doing.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
--
Kind Regards,
Gavin Henry.
Managing Director.
T +44 (0) 330 44 50 000
D +44 (0) 330 44 55 007
M +44 (0) 7930 323266
F +44 (0) 1224 824887
E ***@***.***
Open Source. Open Solutions(tm).
http://www.suretecsystems.com/
Suretec Systems is a limited company registered in Scotland. Registered
number: SC258005. Registered office: The James Gregory Centre, Campus 2,
Balgownie Road, Aberdeen. AB22 8GU.
Subject to disclaimer at http://www.suretecgroup.com/disclaimer.html
HI @aberaud
Just bringing in the new changes in your example into my code and note:
opendht/tools/dhtcnode.c
Line 248 in 0302cee
https://man7.org/linux/man-pages/man3/usleep.3.html#CONFORMING_TO
so this fails to compile in my code.
Also, what's the benefit of bringing
atomic_XXX
? We also now have two set ofctx
objects to manage.Thanks.
The text was updated successfully, but these errors were encountered: