Coos using tutorials-Status of tasks

Source: Internet
Author: User

In Coos, the task has four states, namely: Ready state, running state, waiting state, dormant state.

Why do you want to separate the state?

The goal is to give the CPU to more needed tasks, for example, you open a browser and open a game (need full screen), so when you play the game, let the browser this task hangs, to enter the waiting state.

Then the entire CPU is serving the game, without the advent of the card.

The same principle, can also be used in single-chip microcomputer.


1, Cogetcurtaskid (), get the task ID number

Os_tid cogetcurtaskid (void);

This function, which can only be used within the task, gets the task ID number, and allows the task to enter a different state.

Returns the Os_tid variable if the ID number is successfully obtained.

2, Cosuspendtask (), suspend task

Statustype Cosuspendtask (Os_tid TaskID);

3, Coawaketask (), Wake up task

Statustype Coawaketask (Os_tid TaskID);

After task a hangs, it cannot enter the ready state itself, and must wait for other tasks to wake it up.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.