xiaoxiang781216 commented on code in PR #10752:
URL: https://github.com/apache/nuttx/pull/10752#discussion_r1333113448


##########
include/pthread.h:
##########
@@ -839,7 +844,12 @@ typedef FAR struct pthread_spinlock_s pthread_spinlock_t;
 #endif /* CONFIG_PTHREAD_SPINLOCKS */
 
 #ifndef __PTHREAD_ONCE_T_DEFINED
-typedef bool pthread_once_t;
+typedef struct pthread_once_t_

Review Comment:
   ```suggestion
   typedef struct pthread_once_s
   ```



##########
libs/libc/pthread/pthread_once.c:
##########
@@ -73,25 +71,29 @@ int pthread_once(FAR pthread_once_t *once_control,
       return EINVAL;
     }
 
+  if (!once_control->init)
+    {
+      once_control->init = true;

Review Comment:
   race, mutex may initialize twice. caller should use PTHREAD_ONCE_INIT



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to