From ba38fe5b97c2401830d612376d198f1d3c811969 Mon Sep 17 00:00:00 2001 From: Antonis Geralis <43617260+planetis-m@users.noreply.github.com> Date: Sat, 31 Dec 2022 20:25:35 +0200 Subject: [PATCH] core_loading_thread example join thread on completion (#2845) * core_loading_thread example join thread on completion * error checking --- examples/core/core_loading_thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/core/core_loading_thread.c b/examples/core/core_loading_thread.c index 09ec76460..5ab8bbc3a 100644 --- a/examples/core/core_loading_thread.c +++ b/examples/core/core_loading_thread.c @@ -72,6 +72,10 @@ int main(void) if (atomic_load(&dataLoaded)) { framesCounter = 0; + int error = pthread_join(threadId, NULL); + if (error != 0) TraceLog(LOG_ERROR, "Error joining loading thread"); + else TraceLog(LOG_INFO, "Loading thread terminated successfully"); + state = STATE_FINISHED; } } break;