[vlc-devel] commit: vlc_object_waitpipe: cancellation safety ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Feb 14 16:12:51 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 14 17:04:38 2010 +0200| [10f105d2bfe55fff1f735af7d4a0ee545bb21120] | committer: Rémi Denis-Courmont
vlc_object_waitpipe: cancellation safety
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10f105d2bfe55fff1f735af7d4a0ee545bb21120
---
src/misc/objects.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index f8b6044..5d445a7 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -356,6 +356,9 @@ int vlc_object_waitpipe( vlc_object_t *obj )
/* This can only ever happen if someone killed us without locking: */
assert (internals->pipes[1] == -1);
+ /* pipe() is not a cancellation point, but write() is and eventfd() is
+ * unspecified (not in POSIX). */
+ int canc = vlc_savecancel ();
#if defined (HAVE_SYS_EVENTFD_H)
internals->pipes[0] = internals->pipes[1] = eventfd (0, EFD_CLOEXEC);
if (internals->pipes[0] == -1)
@@ -370,6 +373,7 @@ int vlc_object_waitpipe( vlc_object_t *obj )
msg_Dbg (obj, "waitpipe: object already dying");
write (internals->pipes[1], &(uint64_t){ 1 }, sizeof (uint64_t));
}
+ vlc_restorecancel (canc);
}
vlc_mutex_unlock (&pipe_lock);
return internals->pipes[0];
More information about the vlc-devel
mailing list