Inheritance diagram for fawkes::FawkesNetworkClientRecvThread:
Public Member Functions | |
FawkesNetworkClientRecvThread (StreamSocket *s, FawkesNetworkClient *parent, Mutex *recv_mutex) | |
Constructor. | |
~FawkesNetworkClientRecvThread () | |
Destructor. | |
void | recv () |
Receive and process messages. | |
virtual void | once () |
Execute an action exactly once. | |
virtual void | loop () |
Code to execute in the thread. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Spawned by the FawkesNetworkClient to handle incoming traffic.
Definition at line 180 of file client.cpp.
fawkes::FawkesNetworkClientRecvThread::FawkesNetworkClientRecvThread | ( | StreamSocket * | s, | |
FawkesNetworkClient * | parent, | |||
Mutex * | recv_mutex | |||
) | [inline] |
Constructor.
s | client stream socket | |
parent | parent FawkesNetworkClient instance | |
recv_mutex | receive mutex, locked while messages are received |
Definition at line 188 of file client.cpp.
fawkes::FawkesNetworkClientRecvThread::~FawkesNetworkClientRecvThread | ( | ) | [inline] |
virtual void fawkes::FawkesNetworkClientRecvThread::loop | ( | ) | [inline, virtual] |
Code to execute in the thread.
Implement this method to hold the code you want to be executed continously. If you do not implement this method, the default is that the thread will exit. This is useful if you choose to only implement once().
Reimplemented from fawkes::Thread.
Definition at line 246 of file client.cpp.
References fawkes::FawkesNetworkClient::connection_died(), fawkes::Thread::exit(), fawkes::Socket::poll(), fawkes::Socket::POLL_ERR, fawkes::Socket::POLL_HUP, fawkes::Socket::POLL_IN, fawkes::Socket::POLL_RDHUP, and recv().
virtual void fawkes::FawkesNetworkClientRecvThread::once | ( | ) | [inline, virtual] |
Execute an action exactly once.
This code is executed once and only once right after the thread is started before loop() is called. This is useful if you want to implement an one-shot background job. Just implement once() and leave once() untouched. Start the thread and detach it and it will just do its job and then die automatically. If you use set_delete_on_exit(true) even the Thread instance will be automatically deleted.
Reimplemented from fawkes::Thread.
Definition at line 241 of file client.cpp.
References fawkes::FawkesNetworkClient::set_recv_slave_alive().
void fawkes::FawkesNetworkClientRecvThread::recv | ( | ) | [inline] |
Receive and process messages.
Definition at line 210 of file client.cpp.
References fawkes::FawkesNetworkClient::dispatch_message(), fawkes::LockQueue< Type >::lock(), fawkes::FawkesNetworkTransceiver::recv(), fawkes::MutexLocker::unlock(), fawkes::LockQueue< Type >::unlock(), and fawkes::FawkesNetworkClient::wake_handlers().
Referenced by loop().
virtual void fawkes::FawkesNetworkClientRecvThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Reimplemented from fawkes::Thread.
Definition at line 275 of file client.cpp.
References fawkes::Thread::run().