-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
address warnings and races using atomics #1378
base: master
Are you sure you want to change the base?
Conversation
i only re-arranged the macros - why is it now unhappy with the 'static inline' function? |
Maybe P.S. but I has almost zero knowledge about win32 stuff |
2c138ba
to
7c00c24
Compare
thanks for the pointer - i hadn't noticed those! i manged to get visual code installed and configured with openssl (what a pain). |
the build runs through on my windows computer, so i'm marking this as ready for review |
tests for openbsd were failing in actions as well - should i look into the failed checks for this PR? |
I guess that the issue is in CI environment itself:
Can be fixed with adjusting maximum of open file descriptors |
There is one test that needs to get EMFILE error (dns AFAIR), so the test sets rlimit_max to some small number and fill the fds, so maybe it is this test.
No, they are not stable (I wish they can be marked as skipped instead of failed, but still run) |
@azat what does this PR need to go continue on its way? |
7c00c24
to
7fb0ba8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azat what does this PR need to go continue on its way?
This is a very desired patch! But let's address the comment first.
Fixes libevent#779. Signed-off-by: Harvey Tuch <htuch@google.com>
7fb0ba8
to
55f2ed9
Compare
@yogo1212 I've changed the primitives (copied one from ffmpeg) and also made some fixes and now everything should be safe. There is a simple test that before shows the data-race for both variables ( How does this looks to you? |
@azat Sure! The single definition looks much nicer and the windows-only header is a neat way to not have to do that in C code 👍 No idea how About protecting
Atm, the best way I see to avoid using more costly synchronisation while having 100% thread safety, is using only one combined variable for (EDIT: relaxed + volatile might also work but i wouldn't bet any money on it) Libevent requires users to do the debug initialisation before creating any event bases (or events). Imho, the goals are 1. deal with the warnings and 2. make sure the code doesn't fail in a fatal way. |
Based on #1105 and #1363
This should make the code safer but there's now an atomic operation and a loop (to prevent using the debug map before it has been or while it's being initialised) where debug mode is checked.
Fixes: #777
Fixes: #779
Closes: #1105