nested task lock/unlock in rtems?
Smith, Gene
gene.smith at siemens.com
Tue Jan 11 17:28:20 UTC 2005
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.
I can store the nest count in the task notepad value and accomplish what
I want using documented rtems_...() calls. But probably suboptimal.
>
> If you mean via the critical section routines _Thread_Disable_dispatch
> and friends, then the answer is yes -- a nest count is maintained.
This seems like a more direct way to accomplish what I want. Is it ok to
call these from a user task? I don't see it mentioned in the User's
Guide. It seem to be for internal rtems use. I assume the
"disable/enable dispatch" means stop/start preemption. I am trying to
port this functionality:
http://www.roe.ac.uk/atc/projects/vista/software/VxWorks/docs/vxworks/ref/taskLib.html#taskLock
More information about the users
mailing list