diff options
Diffstat (limited to 'src/osd/modules/sync')
| -rw-r--r-- | src/osd/modules/sync/sync_mini.c | 1 | ||||
| -rw-r--r-- | src/osd/modules/sync/sync_ntc.c | 3 | ||||
| -rw-r--r-- | src/osd/modules/sync/sync_os2.c | 2 | ||||
| -rw-r--r-- | src/osd/modules/sync/sync_sdl.c | 5 | ||||
| -rw-r--r-- | src/osd/modules/sync/sync_tc.c | 3 | ||||
| -rw-r--r-- | src/osd/modules/sync/sync_windows.c | 2 | ||||
| -rw-r--r-- | src/osd/modules/sync/work_osd.c | 24 |
7 files changed, 18 insertions, 22 deletions
diff --git a/src/osd/modules/sync/sync_mini.c b/src/osd/modules/sync/sync_mini.c index e710cc7f214..a09303aed80 100644 --- a/src/osd/modules/sync/sync_mini.c +++ b/src/osd/modules/sync/sync_mini.c @@ -160,4 +160,3 @@ int osd_thread_cpu_affinity(osd_thread *thread, UINT32 mask) void osd_thread_wait_free(osd_thread *thread) { } - diff --git a/src/osd/modules/sync/sync_ntc.c b/src/osd/modules/sync/sync_ntc.c index ecd5cd51eaf..9da576b5149 100644 --- a/src/osd/modules/sync/sync_ntc.c +++ b/src/osd/modules/sync/sync_ntc.c @@ -411,7 +411,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout) { if (timeout == OSD_EVENT_WAIT_INFINITE) timeout = osd_ticks_per_second() * (osd_ticks_t)10000; - + pthread_mutex_lock(&event->mutex); if (!timeout) { @@ -531,4 +531,3 @@ void osd_thread_wait_free(osd_thread *thread) pthread_join(thread->thread, NULL); free(thread); } - diff --git a/src/osd/modules/sync/sync_os2.c b/src/osd/modules/sync/sync_os2.c index e6df73d083d..9c0612c1288 100644 --- a/src/osd/modules/sync/sync_os2.c +++ b/src/osd/modules/sync/sync_os2.c @@ -388,7 +388,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout) { ULONG rc; ULONG timeout_param; - + if (timeout == OSD_EVENT_WAIT_INFINITE) timeout_param = SEM_INDEFINITE_WAIT; else diff --git a/src/osd/modules/sync/sync_sdl.c b/src/osd/modules/sync/sync_sdl.c index edfc3d105d4..cea1337c7f8 100644 --- a/src/osd/modules/sync/sync_sdl.c +++ b/src/osd/modules/sync/sync_sdl.c @@ -326,9 +326,9 @@ osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam) thread->callback = callback; thread->param = cbparam; #ifdef SDLMAME_SDL2 - thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread); + thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread); #else - thread->thread = SDL_CreateThread(worker_thread_entry, thread); + thread->thread = SDL_CreateThread(worker_thread_entry, thread); #endif if ( thread->thread == NULL ) { @@ -366,4 +366,3 @@ void osd_thread_wait_free(osd_thread *thread) SDL_WaitThread(thread->thread, &status); free(thread); } - diff --git a/src/osd/modules/sync/sync_tc.c b/src/osd/modules/sync/sync_tc.c index 6c05599baef..b3f63e7c05b 100644 --- a/src/osd/modules/sync/sync_tc.c +++ b/src/osd/modules/sync/sync_tc.c @@ -246,7 +246,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout) { if (timeout == OSD_EVENT_WAIT_INFINITE) timeout = osd_ticks_per_second() * (osd_ticks_t)10000; - + pthread_mutex_lock(&event->mutex); if (!timeout) { @@ -389,4 +389,3 @@ void osd_thread_wait_free(osd_thread *thread) pthread_join(thread->thread, NULL); free(thread); } - diff --git a/src/osd/modules/sync/sync_windows.c b/src/osd/modules/sync/sync_windows.c index b7d266a52ad..85ee4f35fd7 100644 --- a/src/osd/modules/sync/sync_windows.c +++ b/src/osd/modules/sync/sync_windows.c @@ -244,7 +244,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout) timeout_param = INFINITE; else timeout_param = timeout * 1000 / osd_ticks_per_second(); - + int ret = WaitForSingleObject((HANDLE) event, timeout_param); return (ret == WAIT_OBJECT_0); } diff --git a/src/osd/modules/sync/work_osd.c b/src/osd/modules/sync/work_osd.c index 6c080b5a2ed..89dec09b122 100644 --- a/src/osd/modules/sync/work_osd.c +++ b/src/osd/modules/sync/work_osd.c @@ -70,22 +70,22 @@ typedef void *PVOID; template<typename _PtrType> static void spin_while(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout, const int invert = 0) { - osd_ticks_t stopspin = osd_ticks() + timeout; - - do { - int spin = 10000; - while (--spin) - { - if ((*ptr != val) ^ invert) - return; - } - } while (((*ptr == val) ^ invert) && osd_ticks() < stopspin); + osd_ticks_t stopspin = osd_ticks() + timeout; + + do { + int spin = 10000; + while (--spin) + { + if ((*ptr != val) ^ invert) + return; + } + } while (((*ptr == val) ^ invert) && osd_ticks() < stopspin); } template<typename _PtrType> static void spin_while_not(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout) { - spin_while(ptr, val, timeout, 1); + spin_while(ptr, val, timeout, 1); } @@ -553,7 +553,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) if (item->event == NULL) { // TODO: do we need to measure the spin time here as well? and how can we do it? - spin_while(&item->done, 0, timeout); + spin_while(&item->done, 0, timeout); } // otherwise, block on the event until done |
