File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/libstd/sys/unix/freertos Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ impl Thread {
3939
4040 let mut thread = Thread { id : ptr:: null_mut ( ) , join_mutex, state } ;
4141
42+ join_mutex. lock ( ) ;
43+
4244 let res = xTaskCreate (
4345 thread_start,
4446 name. as_ptr ( ) ,
@@ -49,6 +51,8 @@ impl Thread {
4951 ) ;
5052
5153 if res != pdTRUE {
54+ join_mutex. unlock ( ) ;
55+
5256 if res == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY {
5357 return Err ( io:: Error :: new ( io:: ErrorKind :: Other , "could not allocate required memory for thread" ) ) ;
5458 } else {
@@ -63,8 +67,6 @@ impl Thread {
6367 let arg = Box :: < ( Arc < Mutex > , Arc < AtomicUsize > , Box < Box < dyn FnOnce ( ) > > ) > :: from_raw ( arg as * mut _ ) ;
6468 let ( join_mutex, state, main) = * arg;
6569
66- join_mutex. lock ( ) ;
67-
6870 main ( ) ;
6971 thread_local:: cleanup ( ) ;
7072
You can’t perform that action at this time.
0 commit comments