]> git.sesse.net Git - vlc/commitdiff
Linux: use an eventfd instead of pipe for waking up, if available
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 17 Jan 2009 12:42:40 +0000 (14:42 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 17 Jan 2009 12:43:40 +0000 (14:43 +0200)
configure.ac
src/misc/objects.c

index f792a6266be90e25ea8567426f62844da02c52a0..307f854c12b6dd47807d3978e791e1a6dbc0eea1 100644 (file)
@@ -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])])
index a483926ae274c29ce01c5d188b8654dd016ae33b..0751d3f01dc65b883352c8c38b2e0e60f3892eb9 100644 (file)
@@ -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