diff options
Diffstat (limited to 'src/gos/gos_linux.c')
-rw-r--r-- | src/gos/gos_linux.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/gos/gos_linux.c b/src/gos/gos_linux.c index dac3838f..43371443 100644 --- a/src/gos/gos_linux.c +++ b/src/gos/gos_linux.c @@ -165,15 +165,12 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { } } void gfxSemSignal(gfxSem *pSem) { - if (gfxSemCounter(pSem) < pSem->max) - sem_post(&pSem->sem); - } - semcount_t gfxSemCounter(gfxSem *pSem) { int res; res = 0; sem_getvalue(&pSem->sem, &res); - return res; + if (res < pSem->max) + sem_post(&pSem->sem); } #else void gfxSemInit(gfxSem *pSem, semcount_t val, semcount_t limit) { @@ -239,17 +236,6 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) { pthread_mutex_unlock(&pSem->mtx); } - semcount_t gfxSemCounter(gfxSem *pSem) { - semcount_t res; - - // The locking is really only required if obtaining the count is a divisible operation - // which it might be on a 8/16 bit processor with a 32 bit semaphore count. - pthread_mutex_lock(&pSem->mtx); - res = pSem->cnt; - pthread_mutex_unlock(&pSem->mtx); - - return res; - } #endif // GFX_USE_POSIX_SEMAPHORES #endif /* GFX_USE_OS_LINUX */ |