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)
874
874
875
875
// On POSIX, we allow the thread to be joined even after execution has finished.
876
876
// This is necessary to ensure that thread-local memory can be cleaned up.
877
- //
878
- // The thread is responsible for freeing the startup information
879
877
#if defined(_TTHREAD_WIN32_)
880
878
ti->mThread ->mJoinable = false ;
881
879
#endif
882
880
881
+ // The thread is responsible for freeing the startup information
883
882
delete ti;
883
+
884
884
return 0 ;
885
885
}
886
886
@@ -932,6 +932,12 @@ inline void thread::join()
932
932
#elif defined(_TTHREAD_POSIX_)
933
933
pthread_join (mHandle , NULL );
934
934
#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.
935
941
mJoinable = false ;
936
942
}
937
943
}
You can’t perform that action at this time.
0 commit comments