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 {
29
29
pub unsafe fn new ( name : Option < & CStr > , stack : usize , p : Box < dyn FnOnce ( ) > )
30
30
-> io:: Result < Thread > {
31
31
let join_mutex = Arc :: new ( Mutex :: new ( ) ) ;
32
- join_mutex. lock ( ) ;
33
32
let state = Arc :: new ( AtomicUsize :: new ( RUNNING ) ) ;
34
33
35
34
let arg = box ( join_mutex. clone ( ) , state. clone ( ) , box p) ;
@@ -38,6 +37,7 @@ impl Thread {
38
37
39
38
let mut thread = Thread { id : ptr:: null_mut ( ) , join_mutex, state } ;
40
39
40
+ thread. join_mutex . lock ( ) ;
41
41
42
42
let res = xTaskCreate (
43
43
thread_start,
@@ -49,7 +49,7 @@ impl Thread {
49
49
) ;
50
50
51
51
if res != pdTRUE {
52
- join_mutex. unlock ( ) ;
52
+ thread . join_mutex . unlock ( ) ;
53
53
54
54
if res == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY {
55
55
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