Asynchronous waiting
Channels & subscriptions
Current version · 2.0.0
Returned by ReadChannel<T>::next() to represent one cancellable wait.
NextOperation<T>::get()
Block until the next sample is available and return it.
Type
Sample<T> NextOperation<T>::get();Returns
Sample<T>. See Sample<T>.
Details
- Call conditions: During a single wait.
Errors
- Cancellation, close, or repeated consumption errors.
Example
The device owning channel has started. get() blocks the current thread; other application logic may request cancellation of this wait.
auto operation = channel.next();
const auto sample = operation.get();
std::cout << sample.sequence << '\n';Complete example: async_runtime.cpp.
See also
NextOperation<T>::cancel()
Cancel this one-shot sample wait.
Type
void NextOperation<T>::cancel();Returns
void.
Details
- Call conditions: During a single wait.
Errors
- Cancellation, close, or repeated consumption errors.
See also