-
Notifications
You must be signed in to change notification settings - Fork 83
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
linux "SetEvent" always return 0, won't it fail? #22
Comments
I’m sorry, can you clarify? Setting the event is completely independent (from the outside) from waiting on the event. Example code that behaves differently on Linux and Windows would be helpful. |
neosmart::while(WaitForEvent(event,-1))){
// now doing
do_something();
}
neosmart::SetEvent(event);
|
@inaryart I tried to repo what you described for SetEvent. However, seems like I didn't see the error. SetEvent for the same event twice would just return 1 Here is the output running in windows (ret = 1 twice, which indicates success) Thread 14076 waiting for write event... The output is the same no matter the event is auto-reset or manual-reset or initialState signaled or nonsignaled. |
you are right, |
I think neosmart::event uses return value of 0 as success, which is oppose to windows convention (return value of 1 as success). So you might want to update up-level checker. |
I think this is normal code, it should be part of the project. if(setevent(event) == 1){
// then i known
failedCount++;
} just as my suggestion... |
I think you are misunderstanding what an error in this context means. The calls are fully asynchronous, and will succeed regardless of whether there is another thread on the other end - a The convention on Linux and with the pthreads library (which this library serves as some sort of extension to) is for functions to return error numbers with a return value of zero being no error. Don't check for |
when
WaitForEvent
is not in a waiting state, usingsetevent
should return failureThe text was updated successfully, but these errors were encountered: