Saw
Saw

Reputation: 6416

Fire an event on another process without knowing the process start order

I need the fastest way to fire an event in other process, I know that I may use Mutex, but it is very hard to manage Mutexes when I don't know the order of starting the two processes, one of the processes may be closed or not running, I thought in using FileSystemWatcher, but it has a big overhead, then I thought in using MemoryMappedFiles, I can monitor some named memory mapped file, and fire the event when this file is exists, and delete the file when the event fired, any ideas?

Upvotes: 2

Views: 222

Answers (1)

Dark Falcon
Dark Falcon

Reputation: 44181

Use an EventWaitHandle with a name in EventResetMode.ManualReset mode. Make sure the application which sets it keeps it open. Note that once all handles to it are closed, the event will no longer exist and thus will revert to default.

Upvotes: 4

Related Questions