Ipp32u mfxSchedulerCore::scheduler_wakeup_thread_proc(void *pParam)
{
    mfxSchedulerCore * const pSchedulerCore = (mfxSchedulerCore *) pParam;

    {
        char thread_name[30] = {0};
        my_snprintf(thread_name, sizeof(thread_name)-1, "ThreadName=MSDKHWL#%d", 0);
        MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_SCHED, thread_name);
    }

    // main working cycle for threads
    while (false == pSchedulerCore->m_bQuitWakeUpThread)
    {
        vm_status vmRes;

        vmRes = vm_event_timed_wait(&pSchedulerCore->m_hwTaskDone, pSchedulerCore->m_timer_hw_event);

        // HW event is signaled. Reset all HW waiting tasks.
        if (VM_OK == vmRes||
            VM_TIMEOUT == vmRes)
        {
            vmRes = vm_event_reset(&pSchedulerCore->m_hwTaskDone);

            //MFX_AUTO_LTRACE(MFX_TRACE_LEVEL_SCHED, "HW Event");
            pSchedulerCore->IncrementHWEventCounter();
            pSchedulerCore->WakeUpThreads((mfxU32) MFX_INVALID_THREAD_ID,
                                          MFX_SCHEDULER_HW_BUFFER_COMPLETED);
        }
    }

    return 0x0ccedff;

} // Ipp32u mfxSchedulerCore::scheduler_wakeup_thread_proc(void *pParam)
/* verify if the thread handler is valid */
Ipp32s vm_thread_is_valid(vm_thread *thread)
{
    /* check error(s) */
    if (NULL == thread)
        return 0;

    if (thread->is_valid)
    {
        vm_mutex_lock(&thread->access_mut);
        if (VM_OK == vm_event_timed_wait(&thread->exit_event, 0))
        {
            vm_mutex_unlock(&thread->access_mut);
            vm_thread_wait(thread);
        }
        else
            vm_mutex_unlock(&thread->access_mut);
    }
    return thread->is_valid;

} /* Ipp32s vm_thread_is_valid(vm_thread *thread) */