mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 23:54:35 +00:00
Updates the SDL library to the latest standard bugfix release
This commit is contained in:
parent
cb766f2878
commit
083d2175ea
1280 changed files with 343926 additions and 179615 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -34,8 +34,8 @@ quit(int rc)
|
|||
int SDLCALL
|
||||
SubThreadFunc(void *data)
|
||||
{
|
||||
while (!*(int volatile *) data) {
|
||||
; /* SDL_Delay(10); *//* do nothing */
|
||||
while (!*(int volatile *)data) {
|
||||
; /* SDL_Delay(10); */ /* do nothing */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -46,20 +46,20 @@ ThreadFunc(void *data)
|
|||
SDL_Thread *sub_threads[NUMTHREADS];
|
||||
int flags[NUMTHREADS];
|
||||
int i;
|
||||
int tid = (int) (uintptr_t) data;
|
||||
int tid = (int)(uintptr_t)data;
|
||||
|
||||
SDL_Log("Creating Thread %d\n", tid);
|
||||
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Child%d_%d", tid, i);
|
||||
(void)SDL_snprintf(name, sizeof(name), "Child%d_%d", tid, i);
|
||||
flags[i] = 0;
|
||||
sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]);
|
||||
}
|
||||
|
||||
SDL_Log("Thread '%d' waiting for signal\n", tid);
|
||||
while (SDL_AtomicGet(&time_for_threads_to_die[tid]) != 1) {
|
||||
; /* do nothing */
|
||||
; /* do nothing */
|
||||
}
|
||||
|
||||
SDL_Log("Thread '%d' sending signals to subthreads\n", tid);
|
||||
|
|
@ -73,8 +73,7 @@ ThreadFunc(void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Thread *threads[NUMTHREADS];
|
||||
int i;
|
||||
|
|
@ -85,15 +84,15 @@ main(int argc, char *argv[])
|
|||
/* Load the SDL library */
|
||||
if (SDL_Init(0) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
signal(SIGSEGV, SIG_DFL);
|
||||
(void)signal(SIGSEGV, SIG_DFL);
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Parent%d", i);
|
||||
(void)SDL_snprintf(name, sizeof(name), "Parent%d", i);
|
||||
SDL_AtomicSet(&time_for_threads_to_die[i], 0);
|
||||
threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
|
||||
threads[i] = SDL_CreateThread(ThreadFunc, name, (void *)(uintptr_t)i);
|
||||
|
||||
if (threads[i] == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
|
|
@ -109,5 +108,5 @@ main(int argc, char *argv[])
|
|||
SDL_WaitThread(threads[i], NULL);
|
||||
}
|
||||
SDL_Quit();
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue