Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
  int some_lock(FAR sem_t *sem)
  {
    while ((ret = nxsem_wait(sem)) < 0)
      {
        DEBUGASSERT(ret = -EINTR || ret = -ECANCELED);
        if (ret != -EINTR)
          {
            break;
          }
      }
Code Block
    return ret;
  }

It then returns a success/failure indication. Calling logic would also have to be modified to detect the failure case and handle it appropriately. In the case that the failure case, the calling logic (Function B in this example) needs to clean up and return the failure upstream (to Function A) which must also clean up. Then, eventually, leave_critical_section() will be called and the function will exit correctly.