CooCox CoOS User's Guide
CooCox CoOS User's Guide
CooCox CoOS User's Guide
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
eady state and then inserted into the ready list. Suppose I is a flag which reset<br />
automatically and the tasks (A, B, C) are listed in sequence in the waiting list.<br />
When I is ready, it will inform task A. Then I will be converted to the not-ready<br />
state. Therefore B and C will keep waiting for the next ready state of flag I in the<br />
waiting list.<br />
You can create a flag by calling CoCreateFlag() in <strong>CooCox</strong> <strong>CoOS</strong>. After being<br />
created, you can call CoWaitForSingleFlag() and CoWaitForMultipleFlags() to<br />
wait for a single flag or multiple flags.<br />
Code 4 Wait for a single flag<br />
void myTaskA(void* pdata)<br />
{<br />
..........<br />
flagID = CoCreateFlag(0,0);<br />
CoWaitForSingleFlag(flagID,0);<br />
..........<br />
}<br />
void myTaskB(void* pdata)<br />
{<br />
......<br />
CoSetFlag(flagID);<br />
......<br />
}<br />
// Reset manually, the original state is not-ready<br />
36