Merge commit '3a7f96fd99528968c39b5be81db067ca018d432b' into dev

This commit is contained in:
SimoneN64
2024-09-18 20:42:08 +02:00
641 changed files with 31269 additions and 30646 deletions

View File

@@ -31,7 +31,7 @@ static SDLTest_CommonState *state;
static void DoWork(const int workticks) /* "Work" */
{
const SDL_ThreadID tid = SDL_GetCurrentThreadID();
const SDL_bool is_reader = tid != mainthread;
const bool is_reader = tid != mainthread;
const char *typestr = is_reader ? "Reader" : "Writer";
SDL_Log("%s Thread %" SDL_PRIu64 ": ready to work\n", typestr, tid);
@@ -54,7 +54,7 @@ static int SDLCALL
ReaderRun(void *data)
{
SDL_Log("Reader Thread %" SDL_PRIu64 ": starting up", SDL_GetCurrentThreadID());
while (!SDL_AtomicGet(&doterminate)) {
while (!SDL_GetAtomicInt(&doterminate)) {
DoWork(worktime);
}
SDL_Log("Reader Thread %" SDL_PRIu64 ": exiting!\n", SDL_GetCurrentThreadID());
@@ -71,10 +71,8 @@ int main(int argc, char *argv[])
return 1;
}
SDL_AtomicSet(&doterminate, 0);
SDL_SetAtomicInt(&doterminate, 0);
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Parse commandline */
for (i = 1; i < argc;) {
int consumed;
@@ -138,7 +136,7 @@ int main(int argc, char *argv[])
return 1;
}
SDL_AtomicSet(&doterminate, 0);
SDL_SetAtomicInt(&doterminate, 0);
rwlock = SDL_CreateRWLock();
if (!rwlock) {
@@ -159,11 +157,11 @@ int main(int argc, char *argv[])
}
}
while (!SDL_AtomicGet(&doterminate) && (SDL_GetTicks() < ((Uint64) timeout))) {
while (!SDL_GetAtomicInt(&doterminate) && (SDL_GetTicks() < ((Uint64) timeout))) {
DoWork(writerworktime);
}
SDL_AtomicSet(&doterminate, 1);
SDL_SetAtomicInt(&doterminate, 1);
SDL_Log("Waiting on reader threads to terminate...");
for (i = 0; i < nb_threads; ++i) {
SDL_WaitThread(threads[i], NULL);