pkarashchenko commented on code in PR #6320:
URL: https://github.com/apache/incubator-nuttx/pull/6320#discussion_r882606915


##########
libs/libc/modlib/modlib_registry.c:
##########
@@ -82,40 +68,7 @@ static FAR struct module_s *g_mod_registry;
 
 void modlib_registry_lock(void)
 {
-  pid_t me;
-  int ret;
-
-  /* Do we already hold the semaphore? */
-
-  me = getpid();
-  if (me == g_modlock.holder)
-    {
-      /* Yes... just increment the count */
-
-      g_modlock.count++;
-      DEBUGASSERT(g_modlock.count > 0);
-    }
-
-  /* Take the semaphore (perhaps waiting) */
-
-  else
-    {
-      while ((ret = _SEM_WAIT(&g_modlock.lock)) < 0)
-        {
-          /* The only case that an error should occur here is if
-           * the wait was awakened by a signal.
-           */
-
-          DEBUGASSERT(_SEM_ERRNO(ret) == EINTR ||
-                      _SEM_ERRNO(ret) == ECANCELED);

Review Comment:
   I mean that `modlib_registry_lock` spins in while until success and return 
code was checked vs `ECANCELED`. The `EINTR` is handled inside the 
`nxrmutex_lock`, so the question is only about `ECANCELED` and `DEBUGASSERT`.



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to