[okl4-developer] event server

Josh Matthews jmatthews at ok-labs.com
Wed Apr 23 13:54:55 EST 2008


Hi Jorge,

On Wed, Apr 23, 2008 at 3:07 AM, Jorge Torres <
jorge.torres.maldonado at gmail.com> wrote:

> Wow, message multicast, and broadcast!!!, could you please extend that a
> little to me, are there any example code I can look at, of how this event
> server works, <https://lists.okl4.org/mailman/listinfo/developer>
>

Here is some more information on the event server:

- Events are numbered from 1 to MAX_EVENTS (currently 10)
- Each event has a linked list of listeners; a listener just contains an
L4_ThreadId_t and a notify mask
- A listener registers their interest for a numbered event using
register_event (libs/event/event.h), passing the event number and a mask
that it wants to receive on notification.
- To execute an event, use event_notify, which will  L4_Notify the event
server with the bit corresponding to the event number switched on. You could
also L4_Notify the server yourself with multiple bits switched on to execute
multiple events at once.
- An async handler is implemented in the event server that receives the
notify bitfield. For all bits that are on, the corresponding numbered event
is broadcasted to all listeners of that event via an L4_Notify, using the
mask set for each listener. For a listener to receive the notify it must
obviously have accepted notify messages (using
L4_Accept(L4_NotifyMsgAcceptor)) and set an appropriate notify mask (using
L4_Set_NotifyMask).

So, essentially, the event server is an Async multicaster.

Additionally, other actions can be taken by the event server on the
execution of an event, but this is currently coded directly into the event
server's async handler. For example, the event server is currently only used
to track the primary instance of OK Linux (if there is more than one OK
Linux instance running, the "primary" instance is the instance that will
receive serial input etc). So, the IDL4 interface of the event server is
extended to provide a function that will return the primary instance, and a
function that will register new instances, and on receiving a switch event
the event server switches the primary instance.

To check out how that all works have a look at iguana/event/src/main.c and
libs/event/include/interfaces/event.idl4.

Best regards,

Josh Matthews
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20080423/39f6fb86/attachment.htm 


More information about the Developer mailing list