Commit d9e21e4f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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

parent 46d6a5a4
......@@ -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])])
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment