Repository navigation
Complete the timed wait for event - #1000
Conversation
|
This change replaces the PR that I have submitted about a week ago, but then closed as @jkotas pointed out that we don't really need waiting for multiple objects in the CoreRT PAL. |
|
@gkhanna79 can you take a look please? |
|
@dotnet-bot test OSX Debug please |
98547c6 to
6a6fad0
Compare
|
@jkotas can you take a look please? |
|
@dotnet-bot test this please |
|
LGTM |
| { | ||
| int st = pthread_mutex_init(&m_mutex, NULL); | ||
| ASSERT(st == NULL); | ||
| FATAL_ASSERT(st == 0, "Failed to initialize UnixEvent mutex"); |
There was a problem hiding this comment.
It may be nice to do a proper error handling for the initialization instead of error handling via FATAL_ASSERTs.
There was a problem hiding this comment.
I have used the fail fast, since failure to create the event is non-recoverable. Or can you see a case where we could recover from the failure?
There was a problem hiding this comment.
Right, all events seem to be created during runtime startup today, and so handling the failures using fail fast is not too bad. If we have propagated the failure up, the net result is going to be about the same today.
My point was more from the PAL contract point of view. The create event PAL API can return errors, so why not just return error.
6a6fad0 to
8a57293
Compare
|
@jkotas I've made the change to return INVALID_HANDLE_VALUE when event initialization fails. I've also made similar change to the destruction and updated the CloseHandle. |
|
|
||
| class UnixEvent | ||
| { | ||
| bool m_isValid; |
There was a problem hiding this comment.
Nit - it would be better (less padding) for the bool to be together with other bools.
|
LGTM |
8a57293 to
9c88d1c
Compare
The timed waiting implementation was not finished for OSX, where we need to use relative time wait for the cond variable to achieve reliability even when used fiddles with the system time. Also, autoreset events were not implemented at all. There was also an arithmetic overflow issue in the TimeSpecAdd. This change fixes all of these and also ifdefs out the RhCompatibleReentrantWaitAny for Unix.
9c88d1c to
53faa31
Compare
|
@dotnet-bot test OSX Release please |
|
@dotnet-bot test OSX Debug please |
Complete the timed wait for event
The timed waiting implementation was not finished for OSX, where
we need to use relative time wait for the cond variable to achieve
reliability even when user fiddles with the system time. Also,
autoreset events were not implemented at all.
There was also an arithmetic overflow issue in the TimeSpecAdd.
This change fixes all of these and also ifdefs out the
RhCompatibleReentrantWaitAny for Unix.