When you cancel an ongoing IPC operation using l4_ex_regs, the operation will return with L4_IPC_RECANCELED or L4_IPC_SECANCELED, depending on whether the ex_regs happened during the send or receive phase. If the IPC waits for the beginning of the next period, then that "wait" should be cancelled as well. Therefore, your code could look like this:
error = l4_rt_next_period (...); if (error == L4_IPC_RECANCELED || error == L4_IPC_SECANCELED) { /*
- Preempter aborted the next_period call upon deadline miss and I'm
- now already in my next period (the one I originally
wanted to wait
- for using this next_period call).
*/ } else { /*
- next_period succeeded. I waited until the next period and it has
- now begun. The preempter didn't cancel the call so obviously no
- deadline miss has occurred.
*/ }
So a call to l4_thread_ex_regs is sufficient and I would cancel the next_period-IPC with: l4_thread_ex_regs(main_thread_id, 0xFFFFFFFF, 0xFFFFFFFF, &id1, &id2, &w1, &w2, &w3)?? (l4_thread_id id1=id2=L4_INVALID_ID, l4_umword_t w1,w2,w3).
If it's that simple, it's fine!
Regards, Rene