* ntdll.h (IsEventSignalled): New inline function.
* cygthread.cc (cygthread::terminate_thread): Use IsEventSignalled in place of WaitForSingleObject on event with 0 timeout. * fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Ditto. * fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto. (fhandler_fifo::wait): Ditto. * fhandler_termios.cc (fhandler_termios::bg_check): Ditto. * select.cc (verify_tty_slave): Ditto. * thread.cc (pthread::testcancel): Ditto.
This commit is contained in:
@@ -1292,6 +1292,18 @@ extern "C"
|
||||
fbi.FileAttributes = attr ?: FILE_ATTRIBUTE_NORMAL;
|
||||
return NtSetInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
|
||||
}
|
||||
|
||||
/* This test for a signalled event is twice as fast as calling
|
||||
WaitForSingleObject (event, 0). */
|
||||
inline
|
||||
BOOL NTAPI IsEventSignalled (HANDLE event)
|
||||
{
|
||||
EVENT_BASIC_INFORMATION ebi;
|
||||
return NT_SUCCESS (NtQueryEvent (event, EventBasicInformation,
|
||||
&ebi, sizeof ebi, NULL))
|
||||
&& ebi.SignalState != 0;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /*_NTDLL_H*/
|
||||
|
Reference in New Issue
Block a user