nested task lock/unlock in rtems?
Chris Johns
chrisj at rtems.org
Wed Jan 12 00:16:43 UTC 2005
Smith, Gene wrote:
> Joel Sherrill <joel at OARcorp.com> wrote, On 1/11/2005 11:22 AM:
>
>> Smith, Gene wrote:
>>
>>> Can rtems keep track of nested calls to disable/enable preemption?
>>>
>>> E.g. within a task:
>>>
>>> lock
>>> lock
>>> lock
>>> unlock
>>> unlock
>>> unlock
>>>
>>> Where preemption is disabled on the first lock and not re-enabled
>>> until the last unlock is called? And lock and unlock could be
>>> accomplished by a call to rtems_task_mode. But is there anything in
>>> rtems to ensure a balance?
>>
>>
>>
>> Do you mean via premption via the rtems_task_mode service?
>
>
>
> Yes, as documented in the "RTEMS C User's Guide".
>
>>
>> If so, then no.
>
You are correct in saying RTEMS does not handle this but the application
could by saving the "previous_mode_set" returned from the call to
"rtems_task_mode" when disabling preemption and restoring it rather than
enabling preemption to "unlock".
--
Chris Johns
More information about the users
mailing list