mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
add new pa_mutex_try_lock() API
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2080 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
7a4242522e
commit
031289006b
2 changed files with 13 additions and 0 deletions
|
|
@ -92,6 +92,18 @@ void pa_mutex_lock(pa_mutex *m) {
|
|||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue