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.

#include "CCRTOS"<br />

#define NEW_PRIO 10<br />

void TaskN (void *pdata)<br />

{<br />

...<br />

SetPriority (TaskMId, NEW_PRIO);<br />

...<br />

}<br />

void TaskM (void *pdata)<br />

{<br />

...<br />

}<br />

Note:<br />

1) If the task which to be set is in the waiting list and the priority of this<br />

task being reset to is higher than the current running one, run a task<br />

scheduling.<br />

2) The changing of the priority will influence the order of the lists that<br />

relevant to this priority, such as the mutex list, the event waiting list<br />

and so on.<br />

6.2.6 CoSuspendTask()<br />

Function Prototype:<br />

StatusType CoSuspendTask<br />

(<br />

OS_TID task ID<br />

);<br />

Description:<br />

Suspend the designated task.<br />

Parameters:<br />

[in] task ID<br />

ID of the designated task<br />

Returns:<br />

E_INVALID_ID,<br />

The task ID is invalid.<br />

E_ALREADY_IN_WAITING, The designated task has been in the waiting<br />

state.<br />

E_PROTECTED_TASK, It couldn't suspend idle task.<br />

E_OK,<br />

Suspend the task successfully.<br />

Example Usage:<br />

54

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

Saved successfully!

Ooh no, something went wrong!