2
Copyright (c) 2009-2011 250bpm s.r.o.
3
Copyright (c) 2007-2009 iMatix Corporation
4
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
6
This file is part of 0MQ.
8
0MQ is free software; you can redistribute it and/or modify it under
9
the terms of the GNU Lesser General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
13
0MQ is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU Lesser General Public License for more details.
18
You should have received a copy of the GNU Lesser General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef __ZMQ_IO_THREAD_HPP_INCLUDED__
23
#define __ZMQ_IO_THREAD_HPP_INCLUDED__
30
#include "i_poll_events.hpp"
31
#include "mailbox.hpp"
38
// Generic part of the I/O thread. Polling-mechanism-specific features
39
// are implemented in separate "polling objects".
41
class io_thread_t : public object_t, public i_poll_events
45
io_thread_t (zmq::ctx_t *ctx_, uint32_t tid_);
47
// Clean-up. If the thread was started, it's neccessary to call 'stop'
48
// before invoking destructor. Otherwise the destructor would hang up.
51
// Launch the physical thread.
54
// Ask underlying thread to stop.
57
// Returns mailbox associated with this I/O thread.
58
mailbox_t *get_mailbox ();
60
// i_poll_events implementation.
63
void timer_event (int id_);
65
// Used by io_objects to retrieve the assciated poller object.
66
poller_t *get_poller ();
71
// Returns load experienced by the I/O thread.
76
// I/O thread accesses incoming commands via this mailbox.
79
// Handle associated with mailbox' file descriptor.
80
poller_t::handle_t mailbox_handle;
82
// I/O multiplexing is performed using a poller object.
85
io_thread_t (const io_thread_t&);
86
const io_thread_t &operator = (const io_thread_t&);