Hi Owen,
Thanks for your kindly reply. I attached the snippet of my
code. I have registered a command "watch" in the command stack to activate the watchDb() method.
After the CreateThread () method, I got a returned value for the thread ID and the handle.
However, nothing is printed out like the first operation (print the sentence ("Already in Thread")), which makes me believe that the thread is not run.
I also use a software (like Windows Task Manager) that is able to trace all the Processes and their Threads, but the ThreadFun thread is not in the list.
void watchDb ()
{
if (gpDbr == NULL) {
gpDbr = new AsdkDbReactor();
}
acdbHostApplicationServices()->workingDatabase()->addReactor(gpDbr);
DWORD dwThreadId=0;
if (CreateThread(NULL,
0, (LPTHREAD_START_ROUTINE)ThreadFunc, NULL,
0, &dwThreadId) == NULL)
{
acutPrintf("NULL Thread\n");
return ;
}
acutPrintf("\nThread id = %d\n", dwThreadId);
}
void ThreadFunc () {
acutPrintf("Already in Thread\n");
...
}
Thanks a lot.
Yang