[glib] When creating a pipe for a cancelled cancellable, write to it
- From: Benjamin Otte <otte src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] When creating a pipe for a cancelled cancellable, write to it
- Date: Wed, 19 Aug 2009 09:02:57 +0000 (UTC)
commit 6db03d73a45bc0acae0bb96849733bf0ab7ad454
Author: Benjamin Otte <otte gnome org>
Date: Tue Aug 11 18:50:28 2009 +0200
When creating a pipe for a cancelled cancellable, write to it
Includes (untested) fix for win32 that calls SetEvent() in that case.
gio/gcancellable.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index f5b5c4c..209f5f1 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -226,6 +226,7 @@ set_fd_close_exec (int fd)
static void
g_cancellable_open_pipe (GCancellable *cancellable)
{
+ const char ch = 'x';
GCancellablePrivate *priv;
priv = cancellable->priv;
@@ -238,6 +239,9 @@ g_cancellable_open_pipe (GCancellable *cancellable)
set_fd_nonblocking (priv->cancel_pipe[1]);
set_fd_close_exec (priv->cancel_pipe[0]);
set_fd_close_exec (priv->cancel_pipe[1]);
+
+ if (priv->cancelled)
+ write (priv->cancel_pipe[1], &ch, 1);
}
}
#endif
@@ -371,7 +375,6 @@ g_cancellable_reset (GCancellable *cancellable)
#ifdef G_OS_WIN32
if (priv->event)
ResetEvent (priv->event);
- else
#endif
if (priv->cancel_pipe[0] != -1)
read (priv->cancel_pipe[0], &ch, 1);
@@ -520,8 +523,9 @@ g_cancellable_make_pollfd (GCancellable *cancellable, GPollFD *pollfd)
G_UNLOCK(cancellable);
return FALSE;
}
+ if (priv->cancelled)
+ SetEvent(priv->event);
}
-
priv->fd_refcount++;
G_UNLOCK(cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]