L4Re Operating System Framework
Interface and Usage Documentation
|
L4Re supports the standard pthread library functionality.
Therefore L4Re itself does not contain any documentation for pthreads itself. Please refer to the standard pthread documentation instead.
The L4Re specific parts will be described herein.
Include pthread-l4.h header file:
Return the local thread capability of a pthread thread:
Use pthread_l4_cap(pthread_t t)
to get the capability index of the pthread t.
For example:
Setting the L4 priority of an L4 thread works with a special scheduling policy (other policies do not affect the L4 thread priority):
You can prevent your pthread from running immediately after the call to pthread_create
(..) by adding PTHREAD_L4_ATTR_NO_START
to the create_flags
of the pthread attributes. To finally start the thread you need to call scheduler()->run_thread()
passing the capability of the pthread and scheduling parameters.
pthread_l4_cap()
is guaranteed to return the valid capability slot of the pthread (A) until pthread_join()
or pthread_detach()
is invoked on (A)'s pthread_t
.
pthread_l4_cap()
exposes internal state of the pthread management, take the necessary precautions as you would for any shared data in concurrent environments. If you use pthread_l4_cap()
guarding against concurrency issues is your duty.
There is no guarantee that a valid capability slot points to a present capability.
Example
It is possible to obtain a valid thread capability slot and for l4_task_cap_valid()
to return the capability as not present. The following example showcases a possible sequence of events.