473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Thread and COM Object.

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!
Nov 16 '05 #1
2 1060


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.

Sam Davis wrote:
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!

Nov 16 '05 #2
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. :)

"John Sun" wrote:


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.

Sam Davis wrote:
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!

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Ricardo Pereira | last post by:
Hello all, I have a C# class (in this example, called A) that, in its constructor, starts a thread with a method of its own. That thread will be used to continuously check for one of its...
5
by: Razzie | last post by:
Hi all, A question from someone on a website got me thinking about this, and I wondered if anyone could explain this. A System.Threading.Timer object is garbage collected if it has no...
16
by: droopytoon | last post by:
Hi, I start a new thread (previous one was "thread timing") because I have isolated my problem. It has nothing to do with calling unmanaged C++ code (I removed it in a test application). I...
9
by: Víctor | last post by:
Hello, I'm filling a array of System.Diagnostic.Process by using GetProcesses() method. Due to a retard on this method, I do the call using a function and it passing like a delegate to one...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
7
by: Charles Law | last post by:
My first thought was to call WorkerThread.Suspend but the help cautions against this (for good reason) because the caller has no control over where the thread actually stops, and it might have...
5
by: admin | last post by:
ok This is my main. Pretty much it goes through each category and starts up 4 worker threads that then ask for groups to gether from. My problem is that when the thread gets done it keeps the...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
23
by: Boltar | last post by:
Hi I'm writing a threading class using posix threads on unix with each thread being run by an object instance. One thing I'm not sure about is , if I do the following: myclass::~myclass() {...
6
by: HolyShea | last post by:
All, Not sure if this is possible or not - I've created a class which performs an asynchronous operation and provides notification when the operation is complete. I'd like the notification to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.