changes to build system, emscipten progress (can render solid color, yippie!)

This commit is contained in:
veclavtalica
2025-02-21 19:06:19 +03:00
parent dd4fc45be3
commit f25e27b102
11 changed files with 29 additions and 12 deletions

View File

@ -50,6 +50,7 @@ bool workers_init(size_t worker_count) {
if (worker_count > MAX_WORKERS)
worker_count = MAX_WORKERS;
#ifndef EMSCRIPTEN
/* spawn a bunch of detached threads without references to them */
for (size_t i = 0; i < worker_count; ++i) {
SDL_Thread *thread = SDL_CreateThread(worker_thread, "worker", NULL);
@ -61,11 +62,13 @@ bool workers_init(size_t worker_count) {
workers_job_semaphore = SDL_CreateSemaphore(0);
workers_exit_semaphore = SDL_CreateSemaphore(0);
workers_mutex = SDL_CreateMutex();
#endif
return true;
}
void workers_deinit(void) {
#ifndef EMSCRIPTEN
SDL_LockMutex(workers_mutex);
workers_should_exit = true;
SDL_UnlockMutex(workers_mutex);
@ -77,5 +80,6 @@ void workers_deinit(void) {
SDL_DestroyMutex(workers_mutex);
SDL_DestroySemaphore(workers_job_semaphore);
SDL_DestroySemaphore(workers_exit_semaphore);
#endif
workers_pool_size = 0;
}