File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/libstd/sys/unix/freertos Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ impl Thread {
2929 pub unsafe fn new ( name : Option < & CStr > , stack : usize , p : Box < dyn FnOnce ( ) > )
3030 -> io:: Result < Thread > {
3131 let join_mutex = Arc :: new ( Mutex :: new ( ) ) ;
32- join_mutex. lock ( ) ;
3332 let state = Arc :: new ( AtomicUsize :: new ( RUNNING ) ) ;
3433
3534 let arg = box ( join_mutex. clone ( ) , state. clone ( ) , box p) ;
@@ -38,6 +37,7 @@ impl Thread {
3837
3938 let mut thread = Thread { id : ptr:: null_mut ( ) , join_mutex, state } ;
4039
40+ thread. join_mutex . lock ( ) ;
4141
4242 let res = xTaskCreate (
4343 thread_start,
@@ -49,7 +49,7 @@ impl Thread {
4949 ) ;
5050
5151 if res != pdTRUE {
52- join_mutex. unlock ( ) ;
52+ thread . join_mutex . unlock ( ) ;
5353
5454 if res == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY {
5555 return Err ( io:: Error :: new ( io:: ErrorKind :: Other , "could not allocate required memory for thread" ) ) ;
You can’t perform that action at this time.
0 commit comments