02.01.2015 Views

CooCox CoOS User's Guide

CooCox CoOS User's Guide

CooCox CoOS User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.2 Task State<br />

A task can exist in one of the following states in <strong>CooCox</strong> <strong>CoOS</strong>.<br />

Ready State(TASK_READY):Ready tasks are those that are able to<br />

execute (they are not waiting or dormant) but are not currently executing<br />

because a different task of equal or higher priority is already in the Running<br />

state. A task will be in this state after being created.<br />

Running State(TASK_RUNNING):When a task is actually executing it is<br />

said to be in the Running state. It is currently occupying the processor.<br />

Waiting State(TASK_WAITING):Wait for an event to occur. A task will be<br />

in the waiting state if it is currently waiting for a certain event in <strong>CooCox</strong> <strong>CoOS</strong>.<br />

The Dormant State(TASK_DORMANT):The task has been deleted and is<br />

not available for scheduling. The dormant state is not the same as the waiting<br />

state. Tasks in the waiting state will be reactivated and be available for the<br />

scheduling when its waiting events have satisfied. However, tasks in the<br />

dormant state will never be reactivated.<br />

The state of a task can be changed among the above four states. You can<br />

call CoSuspendTask() to convert a task which in the running or ready state to<br />

the waiting state. By calling CoAwakeTask() you can also convert the state of a<br />

task from the waiting state to the ready state(as shown in Figure 2.2.1).<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!