[vlc-devel] commit: Linux: use an eventfd instead of pipe for waking up, if available ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 17 13:43:44 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 17 14:42:40 2009 +0200| [d9e21e4fc0dfc6a4c809acfbf2572013fba61ff0] | committer: Rémi Denis-Courmont 

Linux: use an eventfd instead of pipe for waking up, if available

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d9e21e4fc0dfc6a4c809acfbf2572013fba61ff0
---

 configure.ac       |    5 ++++-
 src/misc/objects.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index f792a62..307f854 100644
--- a/configure.ac
+++ b/configure.ac
@@ -493,13 +493,16 @@ dnl Check for system libs needed
 need_libc=false
 
 dnl Check for usual libc functions
-AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise uselocale vmsplice])
+AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise uselocale])
 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
 AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
 AC_FUNC_ALLOCA
 AC_CHECK_FUNCS(fcntl)
 
+dnl Check for Linux system calls
+AC_CHECK_FUNCS([vmsplice eventfd])
+
 AH_BOTTOM([#include <vlc_fixups.h>])
 
 AC_CHECK_FUNCS(mmap, [VLC_ADD_PLUGIN([access_mmap])])
diff --git a/src/misc/objects.c b/src/misc/objects.c
index a483926..0751d3f 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -308,7 +308,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
     vlc_spin_destroy( &p_priv->ref_spin );
     vlc_mutex_destroy( &p_priv->lock );
     vlc_cond_destroy( &p_priv->wait );
-    if( p_priv->pipes[1] != -1 )
+    if( p_priv->pipes[1] != -1 && p_priv->pipes[1] != p_priv->pipes[0] )
         close( p_priv->pipes[1] );
     if( p_priv->pipes[0] != -1 )
         close( p_priv->pipes[0] );
@@ -411,6 +411,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);
 
+#ifdef HAVE_EVENTFD
+        if ((internals->pipes[0] = internals->pipes[1] = eventfd (0, 0)) == -1)
+#endif
         if (pipe (internals->pipes))
             internals->pipes[0] = internals->pipes[1] = -1;
         else




More information about the vlc-devel mailing list