Threads Calling Threads?

G

Guest

I'm trying to think something through and am wondering if may have some
suggestions. I am building a Windows service (VStudio 2005, C#) that uses a
COM component to answer a telephone call(s). The aqpplication uses 6 trunk
channels for the lines. What I need to do is initialize all 6 lines and set
the event handler to witfor/answer the call. I have to pass the trun
kchannel to this thread as a parameter. Then, when the phone rings on that
trunk channel I need to start a new thread to do things like play prompts,
get digits, etc. This means that I'll have 6 threads created when the
service starts then dynamic threads to answer the call, etc. Any thoughts
would be greatly appreciated? Thanks a lot.
 
P

Peter Duniho

I'm trying to think something through and am wondering if may have some
suggestions. I am building a Windows service (VStudio 2005, C#) that uses
a COM component to answer a telephone call(s). The aqpplication uses 6
trunk channels for the lines. What I need to do is initialize all 6 lines
and set the event handler to witfor/answer the call. I have to pass the
trun kchannel to this thread as a parameter. Then, when the phone rings
on that trunk channel I need to start a new thread to do things like play
prompts, get digits, etc. This means that I'll have 6 threads created
when the service starts then dynamic threads to answer the call, etc. Any
thoughts would be greatly appreciated? Thanks a lot.

Here's a thought: what is your actual question?

Your subject implies you want one thread to "call" another thread. But
that's not an entirely meaningful concept. In a very limited way, one
thread might "call" a thread that owns some UI element (like a window or
control) by using Invoke. But even there, what is really happening is that
data is copied to a place where the "called" thread can get at it safely,
when it runs, while the "calling" thread just waits for that operation to
complete.

There is no way for one thread to "call" another thread, in the sense that
one normally uses the verb "call" (that is, to pass execution control to a
new function by putting data on a stack, changing the instruction pointer,
and having the called function do its work and then return control to the
calling code).

There are ways to get data from one thread to another, but without knowing
what data you really want to pass and without knowing *when* you want to
pass it, it's hard to answer the question that you haven't really asked
anyway, even assuming that's the question you meant to ask. For what it's
worth, the most common means of passing data to a thread is to provide some
object that encapsulates the data when creating the thread in the first
place. The thread's entry point gets the reference to that object, from
which it can obtain the data being passed.

We don't necessarily even know what things like "trunk channels", "lines",
"play prompts", "get digits", etc. mean. It's doubtful that we need to
know, but if they are important to your question, you should define your
terms. If they are not important to your question, you should leave them
out entirely.

And of course, it should go without saying, that at some point if you want a
question answered, you should actually ask it.

Thanks,
Pete
 

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