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 {
39
39
40
40
let mut thread = Thread { id : ptr:: null_mut ( ) , join_mutex, state } ;
41
41
42
+ join_mutex. lock ( ) ;
43
+
42
44
let res = xTaskCreate (
43
45
thread_start,
44
46
name. as_ptr ( ) ,
@@ -49,6 +51,8 @@ impl Thread {
49
51
) ;
50
52
51
53
if res != pdTRUE {
54
+ join_mutex. unlock ( ) ;
55
+
52
56
if res == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY {
53
57
return Err ( io:: Error :: new ( io:: ErrorKind :: Other , "could not allocate required memory for thread" ) ) ;
54
58
} else {
@@ -63,8 +67,6 @@ impl Thread {
63
67
let arg = Box :: < ( Arc < Mutex > , Arc < AtomicUsize > , Box < Box < dyn FnOnce ( ) > > ) > :: from_raw ( arg as * mut _ ) ;
64
68
let ( join_mutex, state, main) = * arg;
65
69
66
- join_mutex. lock ( ) ;
67
-
68
70
main ( ) ;
69
71
thread_local:: cleanup ( ) ;
70
72
You can’t perform that action at this time.
0 commit comments