Iam creating a worker thread using AfxBeginThread inside a COM Inproc DLL and when i call the particular function through the thread it take more CPU time than
the one without a thread.....why is this happening ?
Printable View
Iam creating a worker thread using AfxBeginThread inside a COM Inproc DLL and when i call the particular function through the thread it take more CPU time than
the one without a thread.....why is this happening ?
When you create the worker thread, what is it doing when it has no work to do? Is it in a tight loop waiting for work, or does is suspend itself until its told that more work is available?
I call a particular global function through the AfxBeginbthread.
I give a Normal priority for this message.
When i click a mouse button this thread will be started and it does not wait
for anything.
[ Moved thread ]
Sounds like some sort of COM marshalling is going on.
In single apartment threaded COM objects the calls to methods are marshalled - i.e. the methods aren't actually called directly but run through a 'seperation' mechanism.
If you start up your app in a multi threaded apartment mode and enable your com object to support 'both' single & multi threaded apartments I think you'll find that it won't slow down.
Darwen.