ofDocsdocumentation utils ofThreadChannel

ofThreadChannel


close( )

void close()

Close the ofThreadChannel.

Closing the ofThreadChannel means that no new messages can be sent or received. All threads waiting to receive new values will be notified and all ofThreadChannel::receive and ofThreadChannel::tryReceive methods will return false.


empty( )

bool empty()

Queries empty channel.

This call is only an approximation, since messages come from a different thread the channel can return true when calling empty() and then receive a message right afterwards


ofThreadChannel( )

ofThreadChannel()

receive( ... )

bool receive(T &sentValue)

send( ... )

bool send(T &&value)

send( ... )

bool send(const T &value)

tryReceive( ... )

bool tryReceive(T &sentValue)

tryReceive( ... )

bool tryReceive(T &sentValue, int64_t timeoutMs)

Variables

bool closedTrue if the channel is closed.
condition_variable conditionThe condition even to notify receivers.
mutex mutexThe mutext to protect the data.