KrisLibrary
1.0.0
|
An asynchronous read/writer that uses multithreading. Subclass will define the transport protocol by setting the transport member (usually blocking I/O). More...
#include <AsyncIO.h>
Public Member Functions | |
AsyncPipeThread (double timeout=Math::Inf) | |
virtual void | Reset () |
virtual void | Work () |
virtual bool | Start () |
Subclasses: override these to implement custom starting and stopping routines. | |
virtual void | Stop () |
bool | Connected () |
bool | WriteReady () |
bool | ReadReady () |
Public Member Functions inherited from AsyncPipeQueue | |
AsyncPipeQueue (size_t recvQueueSize=1000, size_t writeQueueSize=1000) | |
void | OnRead (const std::string &msg) |
void | OnRead_NoLock (const std::string &msg) |
bool | WriteAvailable () const |
Called by subclass to see whether there's a message to send. | |
std::string | OnWrite () |
Called by subclass to get the next message to send to the destination. | |
std::string | OnWrite_NoLock () |
int | MessageCount () |
Receive functions. | |
int | UnreadCount () |
std::string | PeekNewest () |
std::vector< std::string > | New () |
std::string | Newest () |
void | Send (const std::string &msg) |
Send functions. | |
int | SentCount () |
int | DeliveredCount () |
Public Attributes | |
std::unique_ptr< TransportBase > | transport |
bool | initialized |
Thread | workerThread |
double | timeout |
Timer | timer |
Mutex | mutex |
double | lastReadTime |
double | lastWriteTime |
Public Attributes inherited from AsyncPipeQueue | |
AsyncReaderQueue | reader |
AsyncWriterQueue | writer |
An asynchronous read/writer that uses multithreading. Subclass will define the transport protocol by setting the transport member (usually blocking I/O).
If no read/write has occurred for 'timeout' seconds, then the thread will quit
Stop() or destructor will quit the read/write threads.