summaryrefslogtreecommitdiff
path: root/sys/winks
diff options
context:
space:
mode:
authorOle André Vadla Ravnås <oravnas@cisco.com>2010-07-01 15:07:41 +0200
committerOle André Vadla Ravnås <oravnas@cisco.com>2010-10-28 17:08:41 +0200
commitcc1c6ee9e3bdc4c2eb5fc73f85e00c6b15afc1a5 (patch)
treeaa2b9c4db2ec3e364ef97fd9e354d26000a48ba0 /sys/winks
parenta7a04fe601b2d9010bdb1b3beae1ed3ae3567748 (diff)
downloadgstreamer-plugins-bad-cc1c6ee9e3bdc4c2eb5fc73f85e00c6b15afc1a5.tar.gz
winks: work around shutdown deadlock
GetOverlappedResult() might never return with some drivers. Time out after 1000 ms. We cannot really fix this without either: 1) Controlling the streaming thread so we can do CancelIo() from that thread. 2) Switch to using IO completion ports.
Diffstat (limited to 'sys/winks')
-rw-r--r--sys/winks/gstksvideodevice.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/winks/gstksvideodevice.c b/sys/winks/gstksvideodevice.c
index bc7de0fac..dbd7f035b 100644
--- a/sys/winks/gstksvideodevice.c
+++ b/sys/winks/gstksvideodevice.c
@@ -254,15 +254,16 @@ gst_ks_video_device_clear_buffers (GstKsVideoDevice * self)
if (priv->requests == NULL)
return;
- /* Cancel pending requests */
- CancelIo (priv->pin_handle);
-
+ /* Join any pending requests */
for (i = 0; i < priv->num_requests; i++) {
ReadRequest *req = &g_array_index (priv->requests, ReadRequest, i);
- DWORD bytes_returned;
+ HANDLE ev = g_array_index (priv->request_events, HANDLE, i);
+ DWORD n;
- GetOverlappedResult (priv->pin_handle, &req->overlapped, &bytes_returned,
- TRUE);
+ if (!GetOverlappedResult (priv->pin_handle, &req->overlapped, &n, FALSE)) {
+ if (WaitForSingleObject (ev, 1000) == WAIT_OBJECT_0)
+ GetOverlappedResult (priv->pin_handle, &req->overlapped, &n, FALSE);
+ }
}
/* Clean up */