fawkes::FawkesNetworkClientRecvThread Class Reference
[Fawkes Network Communication]

Fawkes network client receive thread. More...

Inheritance diagram for fawkes::FawkesNetworkClientRecvThread:

[legend]
List of all members.

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.

Detailed Description

Fawkes network client receive thread.

Spawned by the FawkesNetworkClient to handle incoming traffic.

Author:
Tim Niemueller

Definition at line 180 of file client.cpp.


Constructor & Destructor Documentation

fawkes::FawkesNetworkClientRecvThread::FawkesNetworkClientRecvThread ( StreamSocket s,
FawkesNetworkClient parent,
Mutex recv_mutex 
) [inline]

Constructor.

Parameters:
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]

Destructor.

Definition at line 199 of file client.cpp.


Member Function Documentation

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.

See also:
Thread::run()

Reimplemented from fawkes::Thread.

Definition at line 275 of file client.cpp.

References fawkes::Thread::run().


The documentation for this class was generated from the following file:
Generated on Tue Feb 22 13:32:51 2011 for Fawkes API by  doxygen 1.4.7