mfxStatus mfxSchedulerCore::StopWakeUpThread(void)
{
#if defined(_WIN32) || defined(_WIN64)
    m_bQuitWakeUpThread = true;
    m_timer_hw_event = 1; // we need close threads ASAP
    vm_event_signal(&m_hwTaskDone); 

    // close hardware listening tools
    vm_thread_wait(&m_hwWakeUpThread); 
    vm_thread_close(&m_hwWakeUpThread);
    //no specific path to obtain event
    // let close handle
#if defined  (MFX_VA)
#if defined  (MFX_D3D11_ENABLED)
    if (!m_pdx11event)
    {
        vm_event_destroy(&m_hwTaskDone);
    }
    else
    {
        delete m_pdx11event;
        m_pdx11event = 0;
        m_hwTaskDone.handle = 0; // handle has been obtained by UMD
    }
#endif
#endif

    m_bQuitWakeUpThread = false;
    vm_event_set_invalid(&m_hwTaskDone);
    vm_thread_set_invalid(&m_hwWakeUpThread);
#endif // defined(_WIN32) || defined(_WIN64)

    return MFX_ERR_NONE;

} // mfxStatus mfxSchedulerCore::StopWakeUpThread(void)
/* close thread after all */
void vm_thread_close(vm_thread *thread)
{
    /* check error(s) */
    if (NULL == thread)
        return;

    vm_thread_wait(thread);
    vm_event_destroy(&thread->exit_event);
    vm_mutex_destroy(&thread->access_mut);

} /* void vm_thread_close(vm_thread *thread) */
/* 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) */