*appears* to work correctly on all systems to which I have access (i386 linux/win32, x86_64 linux, powerpc OS X, Sparc Solaris 10), but not all systems are capable of running fgfs. Beyond that, multiple threading bugs were fixed, and the naCall() API changed slightly to support named function arguments. NOTE: this introduces a change in the external API, and therefore this change *must* be compiled against current FlightGear code.
23 lines
708 B
C
23 lines
708 B
C
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#define MAX_SEM_COUNT 1024 // What are the tradeoffs with this value?
|
|
|
|
void* naNewLock()
|
|
{
|
|
LPCRITICAL_SECTION lock = malloc(sizeof(CRITICAL_SECTION));
|
|
InitializeCriticalSection(lock);
|
|
return lock;
|
|
}
|
|
|
|
void naLock(void* lock) { EnterCriticalSection((LPCRITICAL_SECTION)lock); }
|
|
void naUnlock(void* lock) { LeaveCriticalSection((LPCRITICAL_SECTION)lock); }
|
|
void* naNewSem() { return CreateSemaphore(0, 0, MAX_SEM_COUNT, 0); }
|
|
void naSemDown(void* sem) { WaitForSingleObject((HANDLE)sem, INFINITE); }
|
|
void naSemUpAll(void* sem, int count) { ReleaseSemaphore(sem, count, 0); }
|
|
|
|
#endif
|
|
|
|
extern int GccWarningWorkaround_IsoCForbidsAnEmptySourceFile;
|