poll: Prevent false-negative from WAKE_EVENT() on W32
authorРуслан Ижбулатов <lrn1986@gmail.com>
Sun, 27 Jul 2014 03:06:16 +0000 (03:06 +0000)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 11 Aug 2014 06:42:06 +0000 (08:42 +0200)
commit067604b2d3e19215d1d1f5a21c2f36d016c7237b
treede211e3f8d47c1712222d7f8031e01e7d052cfba
parent57e3797e8891450bef6650862300ce688ee14ebd
poll: Prevent false-negative from WAKE_EVENT() on W32

SetEvent() seems to not call SetLastError(0) internally, so checking last
error after calling SetEvent() may return the error from an earlier W32 API
call. Fix this by calling SetlastError(0) explicitly.

Currently WAKE_EVENT() code is cramped into a macro and doesn't look to be
entirely correct. Particularly, it does not check the return value of
SetEvent(), only the thread-local W32 error value. It is likely that SetEvent()
actually just returns non-zero value, but the code mistakenly thinks that the
call has failed, because GetLastError() seems to indicate so.

https://bugzilla.gnome.org/show_bug.cgi?id=733805
gst/gstpoll.c