473,386 Members | 1,647 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.

Process synchronisation

Hi,

I have several processes P1...Pn and every process is running the thread T1.

The proces P1 signales the named event E. I want that when the event E is
signaled, every thread T1 in processes P1..Pn will wake up and invoke a
delegate. Than this thread should wait for the next time, when event E will
be signaled by P1 again, and invoke delegate again.

If the event will be of type AutoReset, than only one thread will wake up
and after that the event will Reset. Thats bad, as other threads will not
wake up and will not invoke a delegate.

If the event will be of type Manual, than all threads T1 will wake up, but
every thread will run in a loop as the event will be still signaled.

My question is: How to wake up all threads, let them execute only once, and
than wait for the next signaled event?

Thanks for help,

Lubomir
Jun 14 '07 #1
2 1506
Lubomir,

I think that in this case, remoting, or WCF might be a good option.
This way, when you need to trigger actions in other processes, you can just
make calls into them, and know when they are all complete, as well.

This is the best solution, IMO, because if you are going to use
threading primitives, you will need multiple ones in order to synchronize
operations between all the processes, and this can be tricky to get right.

If you really need to use threading primitives, I would suggest using a
Semaphore to trigger the other processes (you can have a system wide one).
However, you will have to use an AutoResetEvent that is triggered by the
other processes to indicate to the main process that their work is done.
The main process would have to wait on as many AutoResetEvent instances as
there are other processes that it is waiting for.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Lubomir" <Lu*****@discussions.microsoft.comwrote in message
news:83**********************************@microsof t.com...
Hi,

I have several processes P1...Pn and every process is running the thread
T1.

The proces P1 signales the named event E. I want that when the event E is
signaled, every thread T1 in processes P1..Pn will wake up and invoke a
delegate. Than this thread should wait for the next time, when event E
will
be signaled by P1 again, and invoke delegate again.

If the event will be of type AutoReset, than only one thread will wake up
and after that the event will Reset. Thats bad, as other threads will not
wake up and will not invoke a delegate.

If the event will be of type Manual, than all threads T1 will wake up, but
every thread will run in a loop as the event will be still signaled.

My question is: How to wake up all threads, let them execute only once,
and
than wait for the next signaled event?

Thanks for help,

Lubomir

Jun 14 '07 #2
Nicholas,

Thanks for help.

Lubomir

"Nicholas Paldino [.NET/C# MVP]" wrote:
Lubomir,

I think that in this case, remoting, or WCF might be a good option.
This way, when you need to trigger actions in other processes, you can just
make calls into them, and know when they are all complete, as well.

This is the best solution, IMO, because if you are going to use
threading primitives, you will need multiple ones in order to synchronize
operations between all the processes, and this can be tricky to get right.

If you really need to use threading primitives, I would suggest using a
Semaphore to trigger the other processes (you can have a system wide one).
However, you will have to use an AutoResetEvent that is triggered by the
other processes to indicate to the main process that their work is done.
The main process would have to wait on as many AutoResetEvent instances as
there are other processes that it is waiting for.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Lubomir" <Lu*****@discussions.microsoft.comwrote in message
news:83**********************************@microsof t.com...
Hi,

I have several processes P1...Pn and every process is running the thread
T1.

The proces P1 signales the named event E. I want that when the event E is
signaled, every thread T1 in processes P1..Pn will wake up and invoke a
delegate. Than this thread should wait for the next time, when event E
will
be signaled by P1 again, and invoke delegate again.

If the event will be of type AutoReset, than only one thread will wake up
and after that the event will Reset. Thats bad, as other threads will not
wake up and will not invoke a delegate.

If the event will be of type Manual, than all threads T1 will wake up, but
every thread will run in a loop as the event will be still signaled.

My question is: How to wake up all threads, let them execute only once,
and
than wait for the next signaled event?

Thanks for help,

Lubomir


Jun 14 '07 #3

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

Similar topics

1
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
3
by: wesley | last post by:
Hi List, I have a question on collection synchronisation. For example I have an ArrayList called myList and the code is like this: lock (myList.SyncRoot) { // do update on myList...
12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
10
by: Dumbo Liz | last post by:
Hi I hold a Design Master for development and synchronise this weekly with my colleague who enters data and runs reports. This has worked well for the last 3 months. (He e-mails me a copy and I'm...
0
by: Ondine | last post by:
I have a client running Access 2000 on a desktop (win 98) acting as the 'server' and a Sony Viaio notebook (win 2000). They are synchronising and the data on the laptop is continually getting...
9
by: Dave G | last post by:
The unexpected problem is this - say, 2 pcs called A and B, both running my Access program, both arranged in a FE/BE arrangement. There is an unbound form in the program. When the form opens all...
0
by: tbb | last post by:
Hi is it possible to do the synchronisation of the briefcase programmatically? Greets tim
13
by: bayer.justin | last post by:
Hi, I am trying to communicate with a subprocess via the subprocess module. Consider the following example: <subprocess.Popen object at 0x729f0> Here hey is immediately print to stdout of...
19
by: Hapa | last post by:
Does only reading (never writing) of a variable need thread synchronisation? Thanks for help? PS. Anybody knows a Visual C++ news group?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.