cfCreateThreadMFC & ccThreadID

创建一个线程

ccSemaphore sema(0, 1);
ccThreadID pumpID_;
try
{
    pumpID_ = cfCreateThreadMFC(cfMessagePump, &sema);
}
catch (...)
{
    cogOut << cmT("Thread error") << cmStd endl;
}

cfWaitForThreadTermination

Blocks execution until a specific thread terminates.

ccSemaphore

ccSemaphore sema(0, 1);
sema.lock(); //如果没有被锁,计数减1,如果被锁了,等待
sema->unlock(); //锁计数加1