[okl4-developer] WaitNotify()

Nelson Tam nelson at ok-labs.com
Tue Feb 26 17:53:06 EST 2008


Hi Ryan,

On 26/02/2008, at 10:31 AM, Ryan Heffernan wrote:

> I've currently got an infinite loop that I want to execute every 25  
> ms.
> I have set up a periodic request in the vtimer and have confirmed that
> the vtimer is indeed sending an L4_Notify call every 25 ms. In my  
> loop I
> use an L4_WaitNotify() call to block the thread until it receives a
> timer interrupt, but this doesn't work and the loop just executes
> constantly, hogging up the entire machine. I just wanted to check with
> you guys that the WaitNotify system call should actually be blocking
> until it receives the notify. Also, when I take a look at the tcb of  
> the
> thread containing this loop, the E flag in the message register is set
> and it gives me error code 11. Do you know what this means? The manual
> only has error codes 1-9 :).


The L4_WaitNotify() call will tell the thread to do a blocking-receive  
on notify messages only.  Here are a few things you could check:

1. Are there any other threads sending notify messages to this  
thread?  Turning on tracepoints for async IPC would help you immensely.

2. What did you set the notify mask on your loop thread to?  The  
notify flags are delivered to the thread in MR[1] when it returns from  
L4_WaitNotify() - what are they?

3. An alternate method would be to do the following:

  L4_ThreadId_t sender;
  L4_MsgTag_t tag;
  L4_Msg_t msg;
  L4_Word_t num;

  /* Set thread to receive all notification messages, mask is  
0xffffffff */
  L4_Set_NotifyMask(~0);
  L4_Accept(L4_NotifyMsgAcceptor);

  while(1)
  {
    tag = L4_Wait(&sender);
    L4_MsgStore(tag, &msg);

    /* num contains notify flags */
    num = L4_MsgWord(&msg, 0);

    /* decode each flag and do work accordingly */
  }

--
(nt)

Nelson Tam
nelson at ok-labs.com






More information about the Developer mailing list