diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2011-04-29 12:27:11 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2011-04-29 12:27:11 +0400 |
commit | bd139e52b44f2a066e6908e1cf84a85e16aa502a (patch) | |
tree | ba46a72f732304c27a23729d34f57d439f56d1f2 /winsup/cygwin/ntdll.h | |
parent | 12eac211c9d8cfe8304b0232cd472bc005d71745 (diff) |
* 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.
Diffstat (limited to 'winsup/cygwin/ntdll.h')
-rw-r--r-- | winsup/cygwin/ntdll.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index e9ff11bf0..b420f02d5 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -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*/ |