Explorar o código

core_loading_thread example join thread on completion (#2845)

* core_loading_thread example join thread on completion

* error checking
Antonis Geralis %!s(int64=2) %!d(string=hai) anos
pai
achega
ba38fe5b97
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      examples/core/core_loading_thread.c

+ 4 - 0
examples/core/core_loading_thread.c

@@ -72,6 +72,10 @@ int main(void)
                 if (atomic_load(&dataLoaded))
                 if (atomic_load(&dataLoaded))
                 {
                 {
                     framesCounter = 0;
                     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;
                     state = STATE_FINISHED;
                 }
                 }
             } break;
             } break;