src/ssx/ssx/ssx_semaphore_core.c
int
ssx_semaphore_release_all(SsxSemaphore* semaphore)
{
    SsxMachineContext ctx;

    if (SSX_ERROR_CHECK_API)
    {
        SSX_ERROR_IF_CRITICAL_INTERRUPT_CONTEXT();
        SSX_ERROR_IF(semaphore == 0, SSX_INVALID_SEMAPHORE_AT_RELEASE);
    }

    ssx_critical_section_enter(SSX_NONCRITICAL, &ctx);

    __ssx_thread_queue_union(&__ssx_run_queue, &(semaphore->pending_threads));
    __ssx_thread_queue_clear(&(semaphore->pending_threads));
    __ssx_schedule();

    ssx_critical_section_exit(&ctx);

    return SSX_OK;
}
/// Release all threads blocked on a semaphore
///
/// \param semaphore A pointer to a semaphore
///
/// This API is provided to allow an SSX semaphore to be used as a thread
/// barrier. ssx_semaphore_release_all() simultaneously unblocks all threads
/// (if any) currently pending on a semaphore. A semaphore to be used as a
/// thread barrier will typically be initialized with
/// ssx_semaphore_create(\a sem, 0, 0), and sxx_semaphore_post() would never be
/// called on the \a sem.
///
/// This API never modifies the \a count field of the semaphore; If any
/// threads are blocked on a semaphore the semaphore count is 0 by definition.
///
/// Return values other than SSX_OK (0) are errors; see \ref ssx_errors
///
/// \retval 0 Successful completion
///
/// \retval -SSX_ILLEGAL_CONTEXT The API was called from a critical interrupt
/// context.
///
/// \retval -SSX_INVALID_SEMAPHORE_AT_RELEASE The \a semaphore is a null (0)
/// pointer.
Release all threads blocked on a semaphore
\param semaphore A pointer to a semaphore

This API is provided to allow an SSX semaphore to be used as a thread
barrier. ssx_semaphore_release_all() simultaneously unblocks all threads
(if any) currently pending on a semaphore. A semaphore to be used as a
thread barrier will typically be initialized with
ssx_semaphore_create(\a sem, 0, 0), and sxx_semaphore_post() would never be
called on the \a sem.

This API never modifies the \a count field of the semaphore; If any
threads are blocked on a semaphore the semaphore count is 0 by definition.

Return values other than SSX_OK (0) are errors; see \ref ssx_errors

\retval 0 Successful completion

\retval -SSX_ILLEGAL_CONTEXT The API was called from a critical interrupt
context.

\retval -SSX_INVALID_SEMAPHORE_AT_RELEASE The \a semaphore is a null (0)
pointer.
Release all threads blocked on a semaphore \ param semaphore A pointer to a semaphore This API is provided to allow an SSX semaphore to be used as a thread barrier . ssx_semaphore_release_all () simultaneously unblocks all threads ( if any ) currently pending on a semaphore . A semaphore to be used as a thread barrier will typically be initialized with ssx_semaphore_create ( \ a sem 0 0 ) and sxx_semaphore_post () would never be called on the \ a sem . This API never modifies the \ a count field of the semaphore ; If any threads are blocked on a semaphore the semaphore count is 0 by definition . Return values other than SSX_OK ( 0 ) are errors ; see \ ref ssx_errors \ retval 0 Successful completion \ retval - SSX_ILLEGAL_CONTEXT The API was called from a critical interrupt context . \ retval - SSX_INVALID_SEMAPHORE_AT_RELEASE The \ a semaphore is a null ( 0 ) pointer .
int
ssx_semaphore_release_all(SsxSemaphore* semaphore)
{
    SsxMachineContext ctx;
    if (SSX_ERROR_CHECK_API)
    {
        SSX_ERROR_IF_CRITICAL_INTERRUPT_CONTEXT();
        SSX_ERROR_IF(semaphore == 0, SSX_INVALID_SEMAPHORE_AT_RELEASE);
    }
    ssx_critical_section_enter(SSX_NONCRITICAL, &ctx);
    __ssx_thread_queue_union(&__ssx_run_queue, &(semaphore->pending_threads));
    __ssx_thread_queue_clear(&(semaphore->pending_threads));
    __ssx_schedule();
    ssx_critical_section_exit(&ctx);
    return SSX_OK;
}
int ssx_semaphore_release_all ( SsxSemaphore * semaphore ) { SsxMachineContext ctx ; if ( SSX_ERROR_CHECK_API ) { SSX_ERROR_IF_CRITICAL_INTERRUPT_CONTEXT ( ) ; SSX_ERROR_IF ( semaphore == 0 , SSX_INVALID_SEMAPHORE_AT_RELEASE ) ; } ssx_critical_section_enter ( SSX_NONCRITICAL , & ctx ) ; __ssx_thread_queue_union ( & __ssx_run_queue , & ( semaphore -> pending_threads ) ) ; __ssx_thread_queue_clear ( & ( semaphore -> pending_threads ) ) ; __ssx_schedule ( ) ; ssx_critical_section_exit ( & ctx ) ; return SSX_OK ; }
Release all threads blocked on a semaphore
\param semaphore A pointer to a semaphore
Release all threads blocked on a semaphore \ param semaphore A pointer to a semaphore