GNOME Bugzilla – Bug 733805
poll: WAKE_EVENT() reports false negatives on W32
Last modified: 2014-08-11 06:56:57 UTC
This happens if a pipeline in gst-launch is interrupted via GstLaunchInterrupt: (gst-launch-1.0:11904): GStreamer-CRITICAL **: gstsystemclock: write control failed in wakeup_async: 13:Permission denied (gst-launch-1.0:11904): GStreamer-CRITICAL **: gst_system_clock_remove_wakeup: assertion 'sysclock->priv->wakeup_count > 0' failed Actually, nothing is failing, just WAKE_EVENT() looking at leaked error value.
Created attachment 281800 [details] [review] 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.
It should probably become an inline function or a multi-line macro :) The comma operator is not very nice. commit b87c55f6ed83e11a483f43d6bc29a9d4a79c786f Author: Руслан Ижбулатов <lrn1986@gmail.com> Date: Sun Jul 27 03:06:16 2014 +0000 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