Minor changes to threading
- Renamed `cpp11_thread.cpp` to `thread.cpp` - Removed features that are only supported by Win32 threads (`thread_wait` with timeout and mutex with spinlock) - Fixed formatting in `thread.cpp`
This commit is contained in:
@@ -374,7 +374,7 @@ MUNTOBJ := midi_mt32.o \
|
||||
endif
|
||||
|
||||
ifeq ($(CPPTHREADS), y)
|
||||
THREADOBJ := cpp11_thread.o
|
||||
THREADOBJ := thread.o
|
||||
else
|
||||
THREADOBJ := win_thread.o
|
||||
endif
|
||||
|
||||
@@ -947,7 +947,7 @@ void opengl_close(void)
|
||||
|
||||
SetEvent(sync_objects.closing);
|
||||
|
||||
thread_wait(thread, -1);
|
||||
thread_wait(thread);
|
||||
|
||||
thread_close_mutex(resize_info.mutex);
|
||||
thread_close_mutex(options.mutex);
|
||||
|
||||
@@ -45,14 +45,11 @@ thread_create(void (*func)(void *param), void *param)
|
||||
|
||||
|
||||
int
|
||||
thread_wait(thread_t *arg, int timeout)
|
||||
thread_wait(thread_t *arg)
|
||||
{
|
||||
if (arg == NULL) return(0);
|
||||
|
||||
if (timeout == -1)
|
||||
timeout = INFINITE;
|
||||
|
||||
if (WaitForSingleObject(arg, timeout)) return(1);
|
||||
if (WaitForSingleObject(arg, INFINITE)) return(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -133,17 +130,6 @@ thread_create_mutex(void)
|
||||
}
|
||||
|
||||
|
||||
mutex_t *
|
||||
thread_create_mutex_with_spin_count(unsigned int spin_count)
|
||||
{
|
||||
mutex_t *mutex = malloc(sizeof(CRITICAL_SECTION));
|
||||
|
||||
InitializeCriticalSectionAndSpinCount(mutex, spin_count);
|
||||
|
||||
return mutex;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
thread_wait_mutex(mutex_t *mutex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user