File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -874,13 +874,13 @@ inline void * thread::wrapper_function(void * aArg)
874874
875875 // On POSIX, we allow the thread to be joined even after execution has finished.
876876 // This is necessary to ensure that thread-local memory can be cleaned up.
877- //
878- // The thread is responsible for freeing the startup information
879877#if defined(_TTHREAD_WIN32_)
880878 ti->mThread ->mJoinable = false ;
881879#endif
882880
881+ // The thread is responsible for freeing the startup information
883882 delete ti;
883+
884884 return 0 ;
885885}
886886
@@ -932,6 +932,12 @@ inline void thread::join()
932932#elif defined(_TTHREAD_POSIX_)
933933 pthread_join (mHandle , NULL );
934934#endif
935+
936+ // https://linux.die.net/man/3/pthread_join states:
937+ //
938+ // Joining with a thread that has previously been joined results in undefined behavior.
939+ //
940+ // We just allow a thread to be joined once.
935941 mJoinable = false ;
936942 }
937943}
You can’t perform that action at this time.
0 commit comments