Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
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.

Detailed Description

Protothreads C++ implementation.

Member Enumeration Documentation

◆ state_t

enum Protothread::state_t
101 {
102 WAITING = 0,
103 YIELDED = 1,
104 EXITED = 2,
105 ENDED = 3,
106 };

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;
virtual state_t run()=0
Thread runner function.
#define PT_END()
Declare the end of a protothread.
Definition Protothread.hpp:192
#define PT_BEGIN()
Declare the start of a protothread inside the Protothread::run() function implementing the protothrea...
Definition Protothread.hpp:180

The documentation for this class was generated from the following file: