aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/threads.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-18 06:46:21 -0700
committerChris Robinson <[email protected]>2014-04-18 06:54:18 -0700
commitc041a99f721b6ed7723f786b32f68f6ec1863042 (patch)
tree93fbd1999fcb14e56951b297bb0dac538c20e17d /OpenAL32/Include/threads.h
parentb8d56190d1ab055a5d34f6ea27126098f0bd0370 (diff)
Simplify some error checking
Diffstat (limited to 'OpenAL32/Include/threads.h')
-rw-r--r--OpenAL32/Include/threads.h18
1 files changed, 4 insertions, 14 deletions
diff --git a/OpenAL32/Include/threads.h b/OpenAL32/Include/threads.h
index c78f6ab9..40f523fa 100644
--- a/OpenAL32/Include/threads.h
+++ b/OpenAL32/Include/threads.h
@@ -153,20 +153,13 @@ inline int althrd_sleep(const struct timespec *ts, struct timespec *rem)
inline int almtx_lock(almtx_t *mtx)
{
- int ret = EINVAL;
- if(mtx != NULL)
- ret = pthread_mutex_lock(mtx);
- switch(ret)
- {
- case 0: return althrd_success;
- case EAGAIN: return althrd_busy;
- }
- return althrd_error;
+ if(pthread_mutex_lock(mtx) != 0)
+ return althrd_error;
+ return althrd_success;
}
inline int almtx_unlock(almtx_t *mtx)
{
- if(!mtx) return althrd_error;
if(pthread_mutex_unlock(mtx) != 0)
return althrd_error;
return althrd_success;
@@ -174,13 +167,10 @@ inline int almtx_unlock(almtx_t *mtx)
inline int almtx_trylock(almtx_t *mtx)
{
- int ret = EINVAL;
- if(mtx != NULL)
- ret = pthread_mutex_trylock(mtx);
+ int ret = pthread_mutex_trylock(mtx);
switch(ret)
{
case 0: return althrd_success;
- case EAGAIN:
case EBUSY: return althrd_busy;
}
return althrd_error;