SDF 2.2 preview: IPC with EventWaitHandle

Another feature that missed the 2.1 cutoff – we’ve added a couple things to our existing EventWaitHandle:

A Set() overload:
public bool Set(int data)

A GetData method:
public int GetData()

For simple, fast, and really easy to implement IPC you can just do this:

Process A
EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset, “MY_EVENT_NAME”);

int myData = 10;

Process B
EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset, “MY_EVENT_NAME”);

if (m_eventsHandle.WaitOne())
    int myData = m_eventsHandle.GetData();

No MessageWindows, no queues – no ugliness at all – and it works with really minimal headless CE systems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s