Merge commit '3a7f96fd99528968c39b5be81db067ca018d432b' into dev
This commit is contained in:
12
external/SDL/test/testlock.c
vendored
12
external/SDL/test/testlock.c
vendored
@@ -48,7 +48,7 @@ static void printid(void)
|
||||
static void terminate(int sig)
|
||||
{
|
||||
(void)signal(SIGINT, terminate);
|
||||
SDL_AtomicSet(&doterminate, 1);
|
||||
SDL_SetAtomicInt(&doterminate, 1);
|
||||
}
|
||||
|
||||
static void closemutex(int sig)
|
||||
@@ -56,7 +56,7 @@ static void closemutex(int sig)
|
||||
SDL_ThreadID id = SDL_GetCurrentThreadID();
|
||||
int i;
|
||||
SDL_Log("Thread %" SDL_PRIu64 ": Cleaning up...\n", id == mainthread ? 0 : id);
|
||||
SDL_AtomicSet(&doterminate, 1);
|
||||
SDL_SetAtomicInt(&doterminate, 1);
|
||||
if (threads) {
|
||||
for (i = 0; i < nb_threads; ++i) {
|
||||
SDL_WaitThread(threads[i], NULL);
|
||||
@@ -80,7 +80,7 @@ Run(void *data)
|
||||
(void)signal(SIGTERM, closemutex);
|
||||
}
|
||||
SDL_Log("Thread %" SDL_PRIu64 ": starting up", current_thread);
|
||||
while (!SDL_AtomicGet(&doterminate)) {
|
||||
while (!SDL_GetAtomicInt(&doterminate)) {
|
||||
SDL_Log("Thread %" SDL_PRIu64 ": ready to work\n", current_thread);
|
||||
SDL_LockMutex(mutex);
|
||||
SDL_Log("Thread %" SDL_PRIu64 ": start work!\n", current_thread);
|
||||
@@ -91,7 +91,7 @@ Run(void *data)
|
||||
/* If this sleep isn't done, then threads may starve */
|
||||
SDL_Delay(10);
|
||||
}
|
||||
if (current_thread == mainthread && SDL_AtomicGet(&doterminate)) {
|
||||
if (current_thread == mainthread && SDL_GetAtomicInt(&doterminate)) {
|
||||
SDL_Log("Thread %" SDL_PRIu64 ": raising SIGTERM\n", current_thread);
|
||||
(void)raise(SIGTERM);
|
||||
}
|
||||
@@ -120,8 +120,6 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Enable standard application logging */
|
||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
/* Parse commandline */
|
||||
for (i = 1; i < argc;) {
|
||||
int consumed;
|
||||
@@ -181,7 +179,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
(void)atexit(SDL_Quit_Wrapper);
|
||||
|
||||
SDL_AtomicSet(&doterminate, 0);
|
||||
SDL_SetAtomicInt(&doterminate, 0);
|
||||
|
||||
mutex = SDL_CreateMutex();
|
||||
if (!mutex) {
|
||||
|
||||
Reference in New Issue
Block a user