Thread and COM Object.

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!
 
J

John Sun

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.
 
G

Guest

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. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top