xiaoxiang781216 commented on code in PR #10752:
URL: https://github.com/apache/nuttx/pull/10752#discussion_r1335032461
##########
libs/libc/pthread/pthread_once.c:
##########
@@ -75,23 +73,21 @@ int pthread_once(FAR pthread_once_t *once_control,
/* Prohibit pre-emption while we test and set the once_control. */
- nxrmutex_lock(&g_lock);
+ pthread_mutex_lock(&once_control->mutex);
- if (!*once_control)
+ if (!once_control->done)
{
- *once_control = true;
+ once_control->done = true;
Review Comment:
it's no difference for normal mutex, since the dead lock will happen if the
code try to hold the same mutex recursively in the same thread.
--
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]