- Run down the semaphores so they behave more like a mutex (note: mutexes/condition variables seem to be much slower).

- Fixed: vid_maxfps and cl_capfps could run into a deadlock on Linux based operating systems.

SVN r3900 (trunk)
This commit is contained in:
Braden Obrzut 2012-10-22 23:42:20 +00:00
parent cd2c1f6816
commit 3ec5f7ed88
3 changed files with 20 additions and 13 deletions

View file

@ -53,7 +53,13 @@ typedef semaphore_t Semaphore;
#include <semaphore.h>
typedef sem_t Semaphore;
#define SEMAPHORE_WAIT(sem) \
while(sem_wait(&sem) != 0);
do { \
while(sem_wait(&sem) != 0); \
int semValue; \
sem_getvalue(&sem, &semValue); \
if(semValue < 1) \
break; \
} while(true);
#define SEMAPHORE_SIGNAL(sem) \
sem_post(&sem);
#define SEMAPHORE_INIT(sem, shared, value) \

View file

@ -81,6 +81,7 @@ extern bool GUICapture;
EXTERN_CVAR (Float, Gamma)
EXTERN_CVAR (Int, vid_maxfps)
EXTERN_CVAR (Bool, cl_capfps)
// PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -376,7 +377,7 @@ void SDLFB::Update ()
DrawRateStuff ();
#ifndef __APPLE__
if(vid_maxfps)
if(vid_maxfps && !cl_capfps)
{
SEMAPHORE_WAIT(FPSLimitSemaphore)
}