SDK  23.9.2
For IoT System Software Development
Public Types | Public Member Functions | Protected Member Functions | List of all members
Protothread Class Referenceabstract

Protothreads C++ implementation. More...

#include <Protothread.hpp>

Public Types

enum  state_t { WAITING = 0, YIELDED = 1, EXITED = 2, ENDED = 3 }
 

Public Member Functions

bool post ()
 Post the Protothread to the scheduler.
 

Protected Member Functions

virtual state_t run ()=0
 Thread runner function. More...
 

Detailed Description

Protothreads C++ implementation.

Member Function Documentation

◆ run()

virtual state_t Protothread::run ( )
protectedpure virtual

Thread runner function.

It is a pure virtual function to be implemented by users.

The PT_BEGIN() and PT_END() macros MUST be placed at the begin and the end of this function each other.

class MyProtothread : public Protothread {
public:
state_t run() {
// Do something
PT_END();
} override;
} myThread;

The documentation for this class was generated from the following file:
PT_END
#define PT_END()
Declare the end of a protothread.
Definition: Protothread.hpp:192
Protothread
Protothreads C++ implementation.
Definition: Protothread.hpp:97
Protothread::run
virtual state_t run()=0
Thread runner function.
PT_BEGIN
#define PT_BEGIN()
Declare the start of a protothread inside the Protothread::run() function implementing the protothrea...
Definition: Protothread.hpp:180