【正文】
sk Control Routine Task taskSpawn Task Name and ID Routines Task Information Routines Task Deleting Routines Task Control Routines Task Hook Routines Task Spawn Task Name and ID Routines Task Information Routines Task Information Routines Task Deleting Routines Task Deleting Routines Task Control Routines Task Hook Routines Shared Code and Reentrancy A single copy of code executed by multiple tasks is called shared code. A subroutine is reentrant if a single copy of the routine can be called from several task contexts simultaneously without conflict. Modify global or static variables. Code Reentrancy Solutions Dynamic Stack Variables Guarded Global and Static Variables Task Variables Dynamic Stack Variables Guarded Global and Static Variables Providing a mutualexclusion mechanism to prohibit tasks from simultaneously executing critical sections of code. Task Variables Intertask Communication Shared Data Structure Mutual Exclusion Semaphores Message Queues Pipes Network Intertask Communication Signals Shared Data Structures Global variables Linear buffers Ring buffers Linked lists Pointers Shared Data Structures Mutual Exclusion Disable interrupts Disable preemption Resource locking with semaphores Disable Interrupts The most powerful method It prevents the system from responding to external events for the duration of these locks. Keep the duration of interrupt lockouts short. Preemptive locks Less restrictive form of mutual exclusion. No other task is allowed to preemptive the current executing task, ISR are able to execute. Tasks of higher priority are unable to execute until the locking task leaves the