Tuesday, February 7, 2017

Thread Sample

/* Sample program for Thread. */

int main()
{
    ExecuteOnThread();
}

void * PrintHello(void *usr_info)
{
    //Uncomment below lines to reproduce Defect #43238
    am_audio_source_t source;

    if (NULL != static_cast<TestCTC *>(usr_info))
        static_cast<TestCTC *>(usr_info)->GetActiveSource(AST_Mutex, source);

    DEBUG_PRINT("TestCTC, Active Source: %d\n", source);

   return NULL;
}

int TestCTC::ExecuteOnThread()
{
    pthread_t tid;
    int rc = pthread_create(&tid, NULL, PrintHello, this);
    return 0;
}

No comments:

Post a Comment