/** * Returns true if the task is ready to execute (i.e. not suspended, delayed, or blocked). * @return true if ready, false if not ready. */ bool Task::IsReady() { return taskIsReady(m_taskID); }
void rootTask (long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { WIND_TCB *pTcb; TEST_START(0); pTcb = taskTcb(taskIdSelf()); TEST_ASSERT(pTcb != NULL); bsemid = semBCreate(0xffffffff,0); TEST_ASSERT(bsemid == 0 && errno == S_semLib_INVALID_QUEUE_TYPE); bsemid = semBCreate(SEM_Q_PRIORITY,0); TEST_ASSERT(bsemid != 0); mutexid = semMCreate(0xffffffff); TEST_ASSERT(mutexid == 0 && errno == S_semLib_INVALID_QUEUE_TYPE); mutexid = semMCreate(SEM_Q_PRIORITY|SEM_DELETE_SAFE|SEM_INVERSION_SAFE); TEST_ASSERT(mutexid != 0); taskSpawn("Test1", 20, /* low-pri */ 0, 32768, sem1Task, taskIdSelf(),0,0,0,0,0,0,0,0,0); taskSpawn("Test2", 10, /* intermediate-pri */ 0, 32768, sem2Task, taskIdSelf(),0,0,0,0,0,0,0,0,0); /* This runs at high-pri */ TEST_MARK(); TEST_ASSERT_OK(semTake(bsemid,WAIT_FOREVER)); TEST_MARK(); TEST_ASSERT_OK(taskSuspend(0)); TEST_MARK(); TEST_ASSERT_OK(semTake(mutexid,WAIT_FOREVER)); TEST_MARK(); TEST_ASSERT_OK(semGive(mutexid)); TEST_MARK(); TEST_ASSERT(taskIsReady(taskNameToId("Test2"))); TEST_ASSERT(!taskIsSuspended(taskNameToId("Test2"))); TEST_ASSERT_OK(taskDelay(1)); TEST_MARK(); TEST_CHECK_SEQUENCE(SEQ("root",1), SEQ("Test2",1), SEQ("root",1), SEQ("Test2",1), SEQ("Test1",2), SEQ("Test2",1), SEQ("root",1), SEQ("Test1",1), SEQ("root",2), SEQ("Test2",1), SEQ("root",1), END_SEQ); TEST_FINISH(); }