diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-01 12:12:18 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-01 13:01:21 +0200 |
commit | 64878fd0941bea05deaa12746ba85b00415b6282 (patch) | |
tree | 010afb89511fdaa8873f2c55b937c057b034907a /ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx | |
parent | 14a972653d1db7a03de7e2ae9ac19e047d814893 (diff) |
freetrack: use volatile
Diffstat (limited to 'ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx')
-rw-r--r-- | ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index d5d03011..896d8078 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -40,27 +40,23 @@ private: int main(void) { - ShmPosix lck_posix(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); + ShmPosix lck_posix(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); ShmWine lck_wine("FT_SharedMem", "FT_Mutext", sizeof(FTHeap)); if(!lck_posix.success()) { - printf("Can't open posix map: %d\n", errno); - return 1; - } - if(!lck_wine.success()) { - printf("Can't open Wine map\n"); - return 1; - } + printf("Can't open posix map: %d\n", errno); + return 1; + } + if(!lck_wine.success()) { + printf("Can't open Wine map\n"); + return 1; + } WineSHM* shm_posix = (WineSHM*) lck_posix.ptr(); FTHeap* shm_wine = (FTHeap*) lck_wine.ptr(); FTData* data = &shm_wine->data; create_registry_key(); - while (1) { - lck_posix.lock(); - if (shm_posix->stop) { - lck_posix.unlock(); - break; - } - lck_wine.lock(); + while (1) { + if (shm_posix->stop) + break; data->Yaw = -shm_posix->data[Yaw]; data->Pitch = -shm_posix->data[Pitch]; data->Roll = shm_posix->data[Roll]; @@ -74,8 +70,6 @@ int main(void) shm_posix->gameid = shm_wine->GameID; for (int i = 0; i < 8; i++) shm_wine->table[i] = shm_posix->table[i]; - lck_wine.unlock(); - lck_posix.unlock(); (void) Sleep(4); - } + } } |