Skip to contentSkip to conversation

how to install a "preemption hook"?

Xenomai Tom Z 2 participants 2 messages Mar 11, 2013

lore
Share & tools
lore

Tom Z

author
#0 lore raw

Hi,

I am using native APIs to do some development and have a question recently. I have a task A with a medium priority, so during A's execution, it could be preempted by higher-priority tasks or interrupts. What I want to do is to install a hook so that whenever A is preempted, this hook is executed immediately after A is preempted, but before the execution of the task that preempts A.

How can I accomplish this goal? Any ideas would be highly appreciated.

Tom

#1 lore raw
Quoted 11 lines · Tom Z

Hi,

I am using native APIs to do some development and have a question recently. I have a task A with a medium priority, so during A's execution, it could be preempted by higher-priority tasks or interrupts. What I want to do is to install a hook so that whenever A is preempted, this hook is executed immediately after A is preempted, but before the execution of the task that preempts A.

How can I accomplish this goal? Any ideas would be highly appreciated.

In kernel-space, you can use rt_task_add_hook:
http://www.xenomai.org/documentation/xenomai-2.6/html/api/group__task.html#ga7452f367f9e17bf2fc0b70f717b96dd8

Signature · 1 line
                                                                Gilles.