You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/07/05 18:32:47 UTC

[GitHub] [incubator-nuttx] acassis commented on pull request #1371: drivers/can: correct checking sem is locked

acassis commented on pull request #1371:
URL: https://github.com/apache/incubator-nuttx/pull/1371#issuecomment-653922957


   Yes, it could return 0 or negative. But in all the tests the sval is compared to < 0.
   
   /****************************************************************************
    * Name:  nxsem_get_value
    *
    * Description:
    *   This function updates the location referenced by 'sval' argument to
    *   have the value of the semaphore referenced by 'sem' without effecting
    *   the state of the semaphore.  The updated value represents the actual
    *   semaphore value that occurred at some unspecified time during the call,
    *   but may not reflect the actual value of the semaphore when it is
    *   returned to the calling task.
    *
    *   If 'sem' is locked, the value return by nxsem_get_value() will either be
    *   zero or a negative number whose absolute value represents the number
    *   of tasks waiting for the semaphore.
    *
    * Input Parameters:
    *   sem - Semaphore descriptor
    *   sval - Buffer by which the value is returned
    *
    * Returned Value:
    *   This is an internal OS interface and should not be used by applications.
    *   It follows the NuttX internal error return policy:  Zero (OK) is
    *   returned on success.  A negated errno value is returned on failure.
    *
    ****************************************************************************/
   


----------------------------------------------------------------
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.

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