In general, an attribute set is built by a bitwise OR of the desired attribute components. The following table lists the set of valid semaphore attributes:
RTEMS.FIFO
- tasks wait by FIFO (default)
RTEMS.PRIORITY
- tasks wait by priority
RTEMS.BINARY_SEMAPHORE
- restrict values to
0 and 1
RTEMS.COUNTING_SEMAPHORE
- no restriction on values
(default)
RTEMS.SIMPLE_BINARY_SEMAPHORE
- restrict values to
0 and 1, do not allow nested access, allow deletion of locked semaphore.
RTEMS.NO_INHERIT_PRIORITY
- do not use priority
inheritance (default)
RTEMS.INHERIT_PRIORITY
- use priority inheritance
RTEMS.PRIORITY_CEILING
- use priority ceiling
RTEMS.NO_PRIORITY_CEILING
- do not use priority
ceiling (default)
RTEMS.LOCAL
- local task (default)
RTEMS.GLOBAL
- global task
Attribute values are specifically designed to be
mutually exclusive, therefore bitwise OR and addition operations
are equivalent as long as each attribute appears exactly once in
the component list. An attribute listed as a default is not
required to appear in the attribute list, although it is a good
programming practice to specify default attributes. If all
defaults are desired, the attribute
RTEMS.DEFAULT_ATTRIBUTES
should be
specified on this call.
This example demonstrates the attribute_set parameter needed to create a
local semaphore with the task priority waiting queue discipline. The
attribute_set parameter passed to the
rtems.semaphore_create
directive could be either
RTEMS.PRIORITY
or RTEMS.LOCAL or RTEMS.PRIORITY
. The attribute_set parameter can be set to
RTEMS.PRIORITY
because RTEMS.LOCAL
is the
default for all created tasks. If a similar semaphore were to be known
globally, then the attribute_set parameter would be
RTEMS.GLOBAL or RTEMS.PRIORITY
.
Copyright © 1988-2008 OAR Corporation