#include <cstddef>
#include "pw_bytes/span.h"
#include "pw_chrono/system_clock.h"
#include "pw_containers/intrusive_list.h"
#include "pw_function/function.h"
#include "pw_status/status.h"
#include "pw_status/status_with_size.h"
#include "pw_stream/stream.h"
#include "pw_sync/lock_annotations.h"
#include "pw_sync/mutex.h"
#include "pw_sync/timed_thread_notification.h"
Go to the source code of this file.
Classes | |
class | pw::stream::MpscWriter |
struct | pw::stream::MpscWriter::Request |
class | pw::stream::MpscReader |
class | pw::stream::BufferedMpscReader< kCapacity > |
Namespaces | |
namespace | pw |
The Pigweed namespace. | |
Functions | |
void | pw::stream::CreateMpscStream (MpscReader &reader, MpscWriter &writer) |
This file defines types related to a multi-producer, single-consumer stream.
The single readers must be constructed in place, while writers can be moved. A reader and writer may be connected using CreateMpscStream()
. Additional writers may be connected by copying a previously connected writer.
Example:
See the MpscReader::ReadAll()
for additional examples.
The types in the files are designed to be used across different threads, but are not completely thread-safe. Data must only be written by an MpscWriter using a single thread, and data must only be read by an MpscReader using a single thread. In other words, multiple calls to Write()
must not be made concurrently, and multiple calls to Read()
and ReadAll()
must not be made concurrently. Calls to other methods, e.g. Close()
, are thread-safe and may be made from any thread.