AceRoutine
1.5.0
A low-memory, fast-switching, cooperative multitasking library using stackless coroutines on Arduino platforms.
|
An unbuffered synchronized channel. More...
#include <Channel.h>
Public Member Functions | |
Channel () | |
Constructor. | |
void | setValue (const T &value) |
Used by COROUTINE_CHANNEL_WRITE() to preserve the value of the write across multiple COROUTINE_YIELD() calls. More... | |
bool | write () |
Same as write(constT& value) except use the value of setValue(). More... | |
bool | write (const T &value) |
Write the given value to the channel through the COROUTINE_AWAIT() if value is a static variable. | |
bool | read (T &value) |
Read the value through the COROUTINE_AWAIT() macro or the COROUTINE_CHANNEL_READ() macro. | |
An unbuffered synchronized channel.
Readers and writers block until the writer is ready to send and the receiver is ready to receive. Then the writer writes, the reader reads, reader continues processing, then the writer continues processing. This sequencing is implemented as a finite state machine.
The result of sending 20 integers from the writer to the reader looks like this:
This sequence of events matches the user's expectations.
|
inline |
Used by COROUTINE_CHANNEL_WRITE() to preserve the value of the write across multiple COROUTINE_YIELD() calls.
Not designed to be used directly by the user.
|
inline |
Same as write(constT& value) except use the value of setValue().
Used by COROUTINE_CHANNEL_WRITE() macro. Not designed to be used directly by the user.