Пример #1
0
int
ssx_thread_info_get(SsxThread*         thread,
                    SsxThreadState*    state,
                    SsxThreadPriority* priority,
                    int*               runnable)
{
    if (SSX_ERROR_CHECK_API)
    {
        SSX_ERROR_IF(thread == 0, SSX_INVALID_THREAD_AT_INFO);
    }

    if (state)
    {
        *state = thread->state;
    }

    if (priority)
    {
        *priority = thread->priority;
    }

    if (runnable)
    {
        *runnable = ((thread->state == SSX_THREAD_STATE_MAPPED) &&
                     __ssx_thread_queue_member(&__ssx_run_queue,
                                               thread->priority));
    }

    return SSX_OK;
}
Пример #2
0
static inline int
__ssx_thread_is_runnable(SsxThread *thread)
{
    return __ssx_thread_queue_member(&__ssx_run_queue, thread->priority);
}