I am using "backgroundworker" to wait a signal input from other program. i found that will be slow down my system performance. Is there any Programming technique can help me to wait a signal from other program or exe? S开发者_JAVA百科o i no need make a thread to wait there is a signal all the time. I need a something like delegate events where there is sometime out coming from other program.. then my function will trigger by accordingly. or is any technique to wait a message or signal from other exe?
You can use named Mutexes for cross process synchronization. Below links should help you understand Mutexes and synchronization techniques:
http://msdn.microsoft.com/en-us/library/system.threading.mutex(v=VS.100).aspx
http://www.albahari.com/threading/part2.aspx
Wanted: Cross-process synch that doesn't suffer from AbandonedMutexException
If you need a robust solution for this cross program or even remote communication consider using a JMS server like ActiveMQ or Microsoft MSMQ (non-JMS). I personally prefer ActiveMQ.
ActiveMQ has adapters for publish and subscribe for topics and queues. You can use http://activemq.apache.org/nms/ for connecting thru C#.
What you're looking for is named pipes.
http://msdn.microsoft.com/en-us/library/bb546085.aspx
精彩评论