Re: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- From: Edward Diener <eddielee_no_spam_here@xxxxxxxxxxxxxx>
- Date: Tue, 26 Aug 2008 00:01:03 -0400
Igor Tandetnik wrote:
"Edward Diener" <eddielee_no_spam_here@xxxxxxxxxxxxxx> wrote in message
news:%23mbcXuwBJHA.4932@xxxxxxxxxxxxxxxxxxxx
workerThread = new CWorkerThread<>;
workerThread ->
AddTimer(1,workerThreadImpl,reinterpret_cast<DWORD_PTR>(data),&workerThreadHandle);
AddTimer doesn't return a handle to the worker thread, but a handle to a waitable timer (see CreateWaitableTimer). Why you believed otherwise is beyond me. The handle gets signaled after 1 ms.
OK, my sheer stupidity but...
I do not understand the AddHandle member function. I am just trying to start a new thread on which to run my background processing. In the AddHandle call it says it takes a waitable handle as the first parameter. Huh ? Where does this handle come from ?
If I do a CreateThread I am returned a handle and can start a new thread .. How do I do the equivalent with CWorkerThread ? I thought I understand how this works but evidently I do not. I would have thought I get back a handle when I start the thread, as in CreateThread, but evidently I must pass a handle initialized from something.
The description of CWorkerThread says:
"This class creates a worker thread or uses an existing one, waits on one or more kernel object handles, and executes a specified client function when one of the handles is signaled."
I am not interested in signaling a handle just to run my worker thread. I just want to run my worker thread and be on my way. Maybe I am just using the wrong functionality and should go back to CreateThread ( or _beginthreadex since I am using C++ ), but I thought that if I program with ATL I should use this neat ATL functionality.
.
- Follow-Ups:
- Re: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- From: Igor Tandetnik
- Re: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- References:
- CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- From: Edward Diener
- CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- Prev by Date: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- Next by Date: Re: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- Previous by thread: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- Next by thread: Re: CWorkerThread and IWorkerThreadClient not working in my ATL COM server code
- Index(es):
Relevant Pages
|