Thread and COM Object.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a COM object that manages a phone line. The COM Object has an Event
OnRingDetected() which is called when someone calls the phone line this COM
object is monitoring. When the OnRingDetected is called it is supposed to
kick off a process that executes a script. I would like this all in a service
that is capable of doing this for multiple phone lines. I was thinking of
placing these objects in a thread but how do you tell the thread not to
terminate while the COM Object is waitng for a call to come in??? Any ideas.
My brain is just fried today.. Thanks for any help!
 
keep a while loop to check some conditions before allowing a thread to exit.

while ( bConditon)
{
// do your stuff.
}

This is a typical service structure. You could also use
WaitForSingleObject of WaitForMultipleObjects to watch for some events.

There are a lot of samples codes if you google.
 
Thanks John. I thought of the while but was concerned for CPU utilization. I
changed my thought process a little. I left the object out of a thread and
just threaded the processing once the call came in. So far it seems ok, until
I have multiple lines running. :)
 
Back
Top