02.01.2015 Views

CooCox CoOS User's Guide

CooCox CoOS User's Guide

CooCox CoOS User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

E_OK,<br />

Example usage:<br />

Delete successfully.<br />

#include "CCRTOS.h"<br />

OS_FlagID flag;<br />

void TaskN (void *pdata)<br />

{<br />

StatusType result;<br />

...<br />

/* Delete the Flag */<br />

result = CoDelFlag (flag, OPT_DEL_ANYWAY);<br />

if (result != E_OK)<br />

{<br />

if (result == E_INVALID_ID)<br />

{<br />

printf("Invalid Flag ID !\n");<br />

}<br />

}<br />

...<br />

}<br />

Note:<br />

When you have deleted a flag successfully, the resources it occupied will<br />

be released. The system will start a task scheduling then so as to give<br />

the execution time to the task which has the highest priority.<br />

6.10.3 CoAcceptSingleFlag()<br />

Function Prototype:<br />

StatusType CoAcceptSingleFlag(<br />

OS_FlagID id<br />

);<br />

Description:<br />

Request for a single flag without waiting.<br />

Parameters:<br />

[in] id<br />

The ID of a specified flag<br />

Returns:<br />

E_INVALID_ID,<br />

The ID of the incoming flag is invalid.<br />

ID E_FLAG_NOT_READY, The flag isn’t in the ready state.<br />

E_OK,<br />

Obtain the flag successfully.<br />

109

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

Saved successfully!

Ooh no, something went wrong!