Fawkes API  Fawkes Development Version
fawkes::FawkesNetworkClientRecvThread Class Reference

Fawkes network client receive thread. More...

Inheritance diagram for fawkes::FawkesNetworkClientRecvThread:

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

Constructor & Destructor Documentation

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

Constructor.

Parameters:
sclient stream socket
parentparent FawkesNetworkClient instance
recv_mutexreceive 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.

References fawkes::RefCount::unref().


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::Socket::poll(), fawkes::Socket::POLL_ERR, fawkes::Socket::POLL_HUP, fawkes::Socket::POLL_RDHUP, fawkes::Thread::exit(), fawkes::Socket::POLL_IN, 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.

void fawkes::FawkesNetworkClientRecvThread::recv ( ) [inline]
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.


The documentation for this class was generated from the following file: