SMP: Fix a IDLE task semaphore operation
This commit is contained in:
parent
3f7f58de9d
commit
f45166af32
|
@ -86,7 +86,7 @@
|
||||||
void mm_seminitialize(FAR struct mm_heap_s *heap)
|
void mm_seminitialize(FAR struct mm_heap_s *heap)
|
||||||
{
|
{
|
||||||
/* Initialize the MM semaphore to one (to support one-at-a-time access to
|
/* Initialize the MM semaphore to one (to support one-at-a-time access to
|
||||||
* private data sets.
|
* private data sets).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(void)sem_init(&heap->mm_semaphore, 0, 1);
|
(void)sem_init(&heap->mm_semaphore, 0, 1);
|
||||||
|
|
|
@ -98,12 +98,34 @@ int os_idletask(int argc, FAR char *argv[])
|
||||||
/* Finish TCB initialization */
|
/* Finish TCB initialization */
|
||||||
|
|
||||||
FAR struct task_tcb_s *rtcb = (FAR struct task_tcb_s *)this_task();
|
FAR struct task_tcb_s *rtcb = (FAR struct task_tcb_s *)this_task();
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Create stdout, stderr, stdin on the IDLE task. These will be
|
/* Create stdout, stderr, stdin on the IDLE task. These will be
|
||||||
* inherited by all of the threads created by the IDLE task.
|
* inherited by all of the threads created by the IDLE task.
|
||||||
|
*
|
||||||
|
* We must have exclusive access to the memory manager to do this BUT the
|
||||||
|
* idle task cannot wait on a semaphore (at least not later in the
|
||||||
|
* initialzation sequency when this thread is started). So loop until
|
||||||
|
* we do finally get access
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ret = kmm_trysemaphore();
|
||||||
|
if (ret >= 0)
|
||||||
|
{
|
||||||
DEBUGVERIFY(group_setupidlefiles(rtcb));
|
DEBUGVERIFY(group_setupidlefiles(rtcb));
|
||||||
|
kmm_givesemaphore();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Perform any processor-specific idle state operations */
|
||||||
|
|
||||||
|
up_idle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (ret < 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enter the IDLE loop */
|
/* Enter the IDLE loop */
|
||||||
|
|
Loading…
Reference in New Issue