473,467 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to communicate between threads

Hi,

I have one thread thats method is called. When the method is called another
thread should be notified. How do I do this?

Christian
Jun 27 '08 #1
4 1924
Depends on the scenario... you could use something like a
ManualResetEvent/AutoResetEvent; you could use a Monitor (Pulse etc). If
the other thread is a UI thread you could use an event (or a delegate as
a callback), and then have the UI jump to the UI-thread via
Control.Invoke/Control.BeginInvoke (or the WPF equivalent); or
SynchronizationContext...

It really depends what the other thread is doing... in particular, you
don't want the first thread to *just* spin up the second thread and then
wait for it to finish - you could just as easily do everything on the
first thread.

Marc
Jun 27 '08 #2
Hi Marc,

thanks for your help.

Christian

"Marc Gravell" wrote:
Depends on the scenario... you could use something like a
ManualResetEvent/AutoResetEvent; you could use a Monitor (Pulse etc). If
the other thread is a UI thread you could use an event (or a delegate as
a callback), and then have the UI jump to the UI-thread via
Control.Invoke/Control.BeginInvoke (or the WPF equivalent); or
SynchronizationContext...

It really depends what the other thread is doing... in particular, you
don't want the first thread to *just* spin up the second thread and then
wait for it to finish - you could just as easily do everything on the
first thread.

Marc
Jun 27 '08 #3
Christian Havel skrev:
Hi,

I have one thread thats method is called. When the method is called another
thread should be notified. How do I do this?

Christian
http://www.yoda.arachsys.com/csharp/threads/

--
Bjørn Brox
Jun 27 '08 #4
Hi Bjørn,

thanks for your help!

Christian

"Bjørn Brox" wrote:
Christian Havel skrev:
Hi,

I have one thread thats method is called. When the method is called another
thread should be notified. How do I do this?

Christian

http://www.yoda.arachsys.com/csharp/threads/

--
Bjørn Brox
Jun 27 '08 #5

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

Similar topics

1
by: Edward C. Jones | last post by:
I have a program named "octave" (a Matlab clone). It runs in a terminal, types a prompt and waits for the user to type something. If I try # Run octave. oct = subprocess.Popen("octave",...
1
by: bscofield | last post by:
Hi, I'm a db app. developer and I am re-writing some helps in javascript & HTML. The Javascript is for form flow and design and HTML just to display the helps. I use a seperate app. development...
1
by: Qumer Mumtaz Goraya | last post by:
Hi How can I communicate between IE and an other application.I am able to communicate between two applications of mine but confused how to do this with IE.I just wanna know how IE get the shared...
4
by: awmcclain.nospam | last post by:
Here's my situation: I'm writing a simple reminder bot which will IM me based on input from a web server. Right now, I have a simple AIM bot written using twisted 2 words. It logs into AIM and...
0
by: Paul Moore | last post by:
I've just hit an annoying corner case in the subprocess module. I'm trying to run a process, pass it some input and capture output and error data: cmd = p = Popen(cmd, stdin=PIPE, stout=PIPE,...
6
by: Mike9900 | last post by:
How can I connect my .NET app which use remoting to communicate over internet, 2 instance of the same app? My app is already done using .NET Remoting. I am wondering if to change them to WCF or...
6
by: Anil Gupte | last post by:
Hi All: I am looking for general directions on "the right way" to do something, which is very critical to my application. I want to communicate with a SQL server database on a Windows Server...
12
by: MrQuan | last post by:
G'day all, I have a requirement to communicate between two or more PCs over the Internet, however I have no idea how to go about this. I'm not talking about a chat programme as such, I want to...
0
by: Lemune | last post by:
Hi all. I'm trying to build an application that will communicate with web server. My application (in C# 2005) will be communicate with some web application (using PHP). For example, my desktop...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.