Event Notification

The best way to understand how event notification works, is to use a mail delivery analogy. Think of yourself as your program. If you use a thread to wait for events (mpiNotifyEventWait), you are waiting for the mail carrier (Event Manager). If you are polling for events (mpiNotifyEventWait), you check the mail periodically.

When the firmware sends an event, it is like a friend (MPI Object) sending you (Thread) a letter (ex: Event -- Motion Done). The letter (Event) travels to the post office (Controller Event Pool) where your mail carrier (Event Manager) retrieves it and then delivers it to your mailbox (Notify Object).

Here are the three common cases:

  1. Thread Waiting for Events As soon as the mail carrier (Event Manager) shows up, the thread in your program checks the mailbox (Notify Object).

  2. Thread Polling for Events The thread in the program periodically checks the mailbox (Notify Object) to see if there is a letter (Event).

  3. Thread using mpiNotifyEventWait If the thread in the program does not check the mailbox (Notify object), it will start to fill up with letters. The mail carrier (Event Manager) keeps stuffing more letters into the mailbox and figures that you will eventually check it. If the thread calls an mpiNotifyEventWait(...), it checks the mailbox. But, it can only check one letter at a time.

  4. Thread using mpiNotifyEventFlush If the thread in the program does not check the mailbox (Notify object), it will start to fill up with letters. The mail carrier (Event Manager) keeps stuffing more letters into the mailbox and figures that you will eventually empty it. If the thread calls mpiNotifyEventFlush(...), mail carrier empties the mailbox and throws all the letters in the trash.