#include <conexus/dataserver.h>
Inheritance diagram for Conexus::DataServer:
Public Member Functions | |
virtual void | start (ReadWrite rw=READ) |
Start the endpoint. | |
virtual void | start (ReadWrite rw, bool use_dispatcher) |
Starts the endpoint, and forces it to use a specific dispatcher value possibly overriding the global default. | |
virtual void | stop (ReadWrite rw=READ) |
Stops any running threads. | |
sigc::signal< void, const Data & > | signal_data () |
Signal emitted when data is read. | |
sigc::signal< void, size_t > | signal_data_received () |
Signal emitted when data is received notifying the callback of the number of bytes read. | |
sigc::signal< void, size_t > | signal_data_transmitted () |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted. | |
virtual void | set_responsiveness (long r) |
Sets the responsiveness to add_*, remove_* and stop commands in microseconds; lower is more responsive; larger is less responsive; default is 500000 microseconds (or 500 ms). | |
virtual long | responsiveness () |
Returns the server responsiveness level. | |
virtual bool | is_running () |
True if the endpoint is running with threaded reads and/or writes. | |
virtual bool | is_read_running () |
True if the endpoint is running with threaded reads. | |
virtual bool | is_write_running () |
True if the endpoint is running with threaded writes. | |
virtual const std::string & | object_type () |
Conexus library string type identifier. | |
Protected Member Functions | |
virtual void | read_thread_main () |
virtual void | read_thread_cleanup () |
virtual void | write_thread_main () |
virtual void | write_thread_cleanup () |
void | queue_received_data (const Data &d) |
void | queue_write_data (const Data &d) |
void | emit_received_data () |
Protected Attributes | |
bool | m_running [2] |
Glib::Thread * | m_thread [2] |
bool | m_terminate |
timeval | m_timeval |
Glib::Mutex | m_mutex_queue [2] |
Glib::Mutex | m_mutex_can_start [2] |
Glib::Dispatcher * | m_dispatcher |
bool | m_use_dispatcher |
sigc::connection | m_dispatcher_connection |
sigc::signal< void, const Data & > | m_signal_data |
sigc::signal< void, size_t > | m_signal_data_received |
sigc::signal< void, size_t > | m_signal_data_transmitted |
std::queue< Data > | m_read_queue |
std::queue< Data > | m_write_queue |
|
Sets the responsiveness to add_*, remove_* and stop commands in microseconds; lower is more responsive; larger is less responsive; default is 500000 microseconds (or 500 ms). In general this refers to the timeout period of the select() call used internally. Each cycle of the server I/O thread acquires several mutex locks at the beginning of the cycle and releases them at the end of the cycle. This value shortens the cycle period, thereby making the server more responsive to commands at the cost of increasing overhead. |
|
Signal emitted when data is read. Connect to this signal if you want to receive all data read by the endpoint. The data object received is unique for each callback point, allowing a callback to modify the data set without effect subsequent callbacks. |
|
Signal emitted when data is received notifying the callback of the number of bytes read. Connect to this signal if you need to know when data is received, and how much, but don't want the data contents. |
|
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted. Connect to this signal if you need to know when data is transmitted, and how much, but don't want the transmitted data contents. |
|
Start the endpoint. If the endpoint is configured for multi-threaded read/write this will create and start the threads. Whether a dispatcher is used or not is dependent upon the global setting which defaults to false, but may be set with Conexus::init() or Conexus::set_use_dispatcher_default(). If you want to handle it manually, endpoints are capable of reading/writing without ever calling start/stop.
|
|
Stops any running threads. Stopping is not immediate. If a read operation is being performed the current read will complete before the thread is stopped. |