[pulseaudio-commits] r2080 - in /trunk/src/pulsecore: mutex-posix.c mutex.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Sat Nov 24 08:24:18 PST 2007
Author: lennart
Date: Sat Nov 24 17:24:16 2007
New Revision: 2080
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2080&root=pulseaudio&view=rev
Log:
add new pa_mutex_try_lock() API
Modified:
trunk/src/pulsecore/mutex-posix.c
trunk/src/pulsecore/mutex.h
Modified: trunk/src/pulsecore/mutex-posix.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/mutex-posix.c?rev=2080&root=pulseaudio&r1=2079&r2=2080&view=diff
==============================================================================
--- trunk/src/pulsecore/mutex-posix.c (original)
+++ trunk/src/pulsecore/mutex-posix.c Sat Nov 24 17:24:16 2007
@@ -92,6 +92,18 @@
pa_assert_se(pthread_mutex_lock(&m->mutex) == 0);
}
+pa_bool_t pa_mutex_try_lock(pa_mutex *m) {
+ int r;
+ pa_assert(m);
+
+ if ((r = pthread_mutex_trylock(&m->mutex)) != 0) {
+ pa_assert(r == EBUSY);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
void pa_mutex_unlock(pa_mutex *m) {
pa_assert(m);
Modified: trunk/src/pulsecore/mutex.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/mutex.h?rev=2080&root=pulseaudio&r1=2079&r2=2080&view=diff
==============================================================================
--- trunk/src/pulsecore/mutex.h (original)
+++ trunk/src/pulsecore/mutex.h Sat Nov 24 17:24:16 2007
@@ -37,6 +37,7 @@
void pa_mutex_free(pa_mutex *m);
void pa_mutex_lock(pa_mutex *m);
+pa_bool_t pa_mutex_try_lock(pa_mutex *m);
void pa_mutex_unlock(pa_mutex *m);
typedef struct pa_cond pa_cond;
More information about the pulseaudio-commits
mailing list