mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-26 18:42:43 +01:00
fd_signaler_t renamed to signaler_t
This commit is contained in:
@@ -63,7 +63,6 @@ libzmq_la_SOURCES = app_thread.hpp \
|
|||||||
epoll.hpp \
|
epoll.hpp \
|
||||||
err.hpp \
|
err.hpp \
|
||||||
fd.hpp \
|
fd.hpp \
|
||||||
fd_signaler.hpp \
|
|
||||||
forwarder.hpp \
|
forwarder.hpp \
|
||||||
fq.hpp \
|
fq.hpp \
|
||||||
i_inout.hpp \
|
i_inout.hpp \
|
||||||
@@ -96,6 +95,7 @@ libzmq_la_SOURCES = app_thread.hpp \
|
|||||||
req.hpp \
|
req.hpp \
|
||||||
select.hpp \
|
select.hpp \
|
||||||
session.hpp \
|
session.hpp \
|
||||||
|
signaler.hpp \
|
||||||
socket_base.hpp \
|
socket_base.hpp \
|
||||||
stdint.hpp \
|
stdint.hpp \
|
||||||
streamer.hpp \
|
streamer.hpp \
|
||||||
@@ -127,7 +127,6 @@ libzmq_la_SOURCES = app_thread.hpp \
|
|||||||
downstream.cpp \
|
downstream.cpp \
|
||||||
epoll.cpp \
|
epoll.cpp \
|
||||||
err.cpp \
|
err.cpp \
|
||||||
fd_signaler.cpp \
|
|
||||||
forwarder.cpp \
|
forwarder.cpp \
|
||||||
fq.cpp \
|
fq.cpp \
|
||||||
io_object.cpp \
|
io_object.cpp \
|
||||||
@@ -151,6 +150,7 @@ libzmq_la_SOURCES = app_thread.hpp \
|
|||||||
req.cpp \
|
req.cpp \
|
||||||
select.cpp \
|
select.cpp \
|
||||||
session.cpp \
|
session.cpp \
|
||||||
|
signaler.cpp \
|
||||||
socket_base.cpp \
|
socket_base.cpp \
|
||||||
streamer.cpp \
|
streamer.cpp \
|
||||||
sub.cpp \
|
sub.cpp \
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include "app_thread.hpp"
|
#include "app_thread.hpp"
|
||||||
#include "dispatcher.hpp"
|
#include "dispatcher.hpp"
|
||||||
#include "fd_signaler.hpp"
|
|
||||||
#include "err.hpp"
|
#include "err.hpp"
|
||||||
#include "pipe.hpp"
|
#include "pipe.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
@@ -75,7 +74,7 @@ void zmq::app_thread_t::stop ()
|
|||||||
send_stop ();
|
send_stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_signaler_t *zmq::app_thread_t::get_signaler ()
|
zmq::signaler_t *zmq::app_thread_t::get_signaler ()
|
||||||
{
|
{
|
||||||
return &signaler;
|
return &signaler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "stdint.hpp"
|
#include "stdint.hpp"
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
#include "yarray.hpp"
|
#include "yarray.hpp"
|
||||||
#include "fd_signaler.hpp"
|
#include "signaler.hpp"
|
||||||
|
|
||||||
namespace zmq
|
namespace zmq
|
||||||
{
|
{
|
||||||
@@ -43,7 +43,7 @@ namespace zmq
|
|||||||
void stop ();
|
void stop ();
|
||||||
|
|
||||||
// Returns signaler associated with this application thread.
|
// Returns signaler associated with this application thread.
|
||||||
fd_signaler_t *get_signaler ();
|
signaler_t *get_signaler ();
|
||||||
|
|
||||||
// Processes commands sent to this thread (if any). If 'block' is
|
// Processes commands sent to this thread (if any). If 'block' is
|
||||||
// set to true, returns only after at least one command was processed.
|
// set to true, returns only after at least one command was processed.
|
||||||
@@ -71,7 +71,7 @@ namespace zmq
|
|||||||
sockets_t sockets;
|
sockets_t sockets;
|
||||||
|
|
||||||
// App thread's signaler object.
|
// App thread's signaler object.
|
||||||
fd_signaler_t signaler;
|
signaler_t signaler;
|
||||||
|
|
||||||
// Timestamp of when commands were processed the last time.
|
// Timestamp of when commands were processed the last time.
|
||||||
uint64_t last_processing_time;
|
uint64_t last_processing_time;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "fd_signaler.hpp"
|
#include "signaler.hpp"
|
||||||
#include "ypipe.hpp"
|
#include "ypipe.hpp"
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
@@ -125,7 +125,7 @@ namespace zmq
|
|||||||
io_threads_t io_threads;
|
io_threads_t io_threads;
|
||||||
|
|
||||||
// Signalers for both application and I/O threads.
|
// Signalers for both application and I/O threads.
|
||||||
std::vector <fd_signaler_t*> signalers;
|
std::vector <signaler_t*> signalers;
|
||||||
|
|
||||||
// Pipe to hold the commands.
|
// Pipe to hold the commands.
|
||||||
typedef ypipe_t <command_t, true,
|
typedef ypipe_t <command_t, true,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void zmq::io_thread_t::stop ()
|
|||||||
send_stop ();
|
send_stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_signaler_t *zmq::io_thread_t::get_signaler ()
|
zmq::signaler_t *zmq::io_thread_t::get_signaler ()
|
||||||
{
|
{
|
||||||
return &signaler;
|
return &signaler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
#include "poller.hpp"
|
#include "poller.hpp"
|
||||||
#include "i_poll_events.hpp"
|
#include "i_poll_events.hpp"
|
||||||
#include "fd_signaler.hpp"
|
#include "signaler.hpp"
|
||||||
|
|
||||||
namespace zmq
|
namespace zmq
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ namespace zmq
|
|||||||
void stop ();
|
void stop ();
|
||||||
|
|
||||||
// Returns signaler associated with this I/O thread.
|
// Returns signaler associated with this I/O thread.
|
||||||
fd_signaler_t *get_signaler ();
|
signaler_t *get_signaler ();
|
||||||
|
|
||||||
// i_poll_events implementation.
|
// i_poll_events implementation.
|
||||||
void in_event ();
|
void in_event ();
|
||||||
@@ -71,7 +71,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Poll thread gets notifications about incoming commands using
|
// Poll thread gets notifications about incoming commands using
|
||||||
// this signaler.
|
// this signaler.
|
||||||
fd_signaler_t signaler;
|
signaler_t signaler;
|
||||||
|
|
||||||
// Handle associated with signaler's file descriptor.
|
// Handle associated with signaler's file descriptor.
|
||||||
poller_t::handle_t signaler_handle;
|
poller_t::handle_t signaler_handle;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fd_signaler.hpp"
|
#include "signaler.hpp"
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include "err.hpp"
|
#include "err.hpp"
|
||||||
#include "fd.hpp"
|
#include "fd.hpp"
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
|
|
||||||
zmq::fd_signaler_t::fd_signaler_t ()
|
zmq::signaler_t::signaler_t ()
|
||||||
{
|
{
|
||||||
// Create eventfd object.
|
// Create eventfd object.
|
||||||
fd = eventfd (0, 0);
|
fd = eventfd (0, 0);
|
||||||
@@ -50,13 +50,13 @@ zmq::fd_signaler_t::fd_signaler_t ()
|
|||||||
errno_assert (rc != -1);
|
errno_assert (rc != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_signaler_t::~fd_signaler_t ()
|
zmq::signaler_t::~signaler_t ()
|
||||||
{
|
{
|
||||||
int rc = close (fd);
|
int rc = close (fd);
|
||||||
errno_assert (rc != -1);
|
errno_assert (rc != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::fd_signaler_t::signal (int signal_)
|
void zmq::signaler_t::signal (int signal_)
|
||||||
{
|
{
|
||||||
zmq_assert (signal_ >= 0 && signal_ < 64);
|
zmq_assert (signal_ >= 0 && signal_ < 64);
|
||||||
uint64_t inc = 1;
|
uint64_t inc = 1;
|
||||||
@@ -65,7 +65,7 @@ void zmq::fd_signaler_t::signal (int signal_)
|
|||||||
errno_assert (sz == sizeof (uint64_t));
|
errno_assert (sz == sizeof (uint64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::poll ()
|
uint64_t zmq::signaler_t::poll ()
|
||||||
{
|
{
|
||||||
// Set to blocking mode.
|
// Set to blocking mode.
|
||||||
int flags = fcntl (fd, F_GETFL, 0);
|
int flags = fcntl (fd, F_GETFL, 0);
|
||||||
@@ -93,7 +93,7 @@ uint64_t zmq::fd_signaler_t::poll ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::check ()
|
uint64_t zmq::signaler_t::check ()
|
||||||
{
|
{
|
||||||
uint64_t signals;
|
uint64_t signals;
|
||||||
ssize_t sz = read (fd, &signals, sizeof (uint64_t));
|
ssize_t sz = read (fd, &signals, sizeof (uint64_t));
|
||||||
@@ -103,14 +103,14 @@ uint64_t zmq::fd_signaler_t::check ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
zmq::fd_t zmq::signaler_t::get_fd ()
|
||||||
{
|
{
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined ZMQ_HAVE_WINDOWS
|
#elif defined ZMQ_HAVE_WINDOWS
|
||||||
|
|
||||||
zmq::fd_signaler_t::fd_signaler_t ()
|
zmq::signaler_t::signaler_t ()
|
||||||
{
|
{
|
||||||
// Windows have no 'socketpair' function. CreatePipe is no good as pipe
|
// Windows have no 'socketpair' function. CreatePipe is no good as pipe
|
||||||
// handles cannot be polled on. Here we create the socketpair by hand.
|
// handles cannot be polled on. Here we create the socketpair by hand.
|
||||||
@@ -162,7 +162,7 @@ zmq::fd_signaler_t::fd_signaler_t ()
|
|||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_signaler_t::~fd_signaler_t ()
|
zmq::signaler_t::~signaler_t ()
|
||||||
{
|
{
|
||||||
int rc = closesocket (w);
|
int rc = closesocket (w);
|
||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
@@ -171,7 +171,7 @@ zmq::fd_signaler_t::~fd_signaler_t ()
|
|||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::fd_signaler_t::signal (int signal_)
|
void zmq::signaler_t::signal (int signal_)
|
||||||
{
|
{
|
||||||
// TODO: Note that send is a blocking operation.
|
// TODO: Note that send is a blocking operation.
|
||||||
// How should we behave if the signal cannot be written to the signaler?
|
// How should we behave if the signal cannot be written to the signaler?
|
||||||
@@ -182,7 +182,7 @@ void zmq::fd_signaler_t::signal (int signal_)
|
|||||||
win_assert (rc != SOCKET_ERROR);
|
win_assert (rc != SOCKET_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::poll ()
|
uint64_t zmq::signaler_t::poll ()
|
||||||
{
|
{
|
||||||
// Switch to blocking mode.
|
// Switch to blocking mode.
|
||||||
unsigned long argp = 0;
|
unsigned long argp = 0;
|
||||||
@@ -202,7 +202,7 @@ uint64_t zmq::fd_signaler_t::poll ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::check ()
|
uint64_t zmq::signaler_t::check ()
|
||||||
{
|
{
|
||||||
unsigned char buffer [32];
|
unsigned char buffer [32];
|
||||||
int nbytes = recv (r, (char*) buffer, 32, 0);
|
int nbytes = recv (r, (char*) buffer, 32, 0);
|
||||||
@@ -218,7 +218,7 @@ uint64_t zmq::fd_signaler_t::check ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
zmq::fd_t zmq::signaler_t::get_fd ()
|
||||||
{
|
{
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
zmq::fd_signaler_t::fd_signaler_t ()
|
zmq::signaler_t::signaler_t ()
|
||||||
{
|
{
|
||||||
int sv [2];
|
int sv [2];
|
||||||
int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
|
int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
|
||||||
@@ -244,13 +244,13 @@ zmq::fd_signaler_t::fd_signaler_t ()
|
|||||||
errno_assert (rc != -1);
|
errno_assert (rc != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_signaler_t::~fd_signaler_t ()
|
zmq::signaler_t::~signaler_t ()
|
||||||
{
|
{
|
||||||
close (w);
|
close (w);
|
||||||
close (r);
|
close (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::fd_signaler_t::signal (int signal_)
|
void zmq::signaler_t::signal (int signal_)
|
||||||
{
|
{
|
||||||
zmq_assert (signal_ >= 0 && signal_ < 64);
|
zmq_assert (signal_ >= 0 && signal_ < 64);
|
||||||
unsigned char c = (unsigned char) signal_;
|
unsigned char c = (unsigned char) signal_;
|
||||||
@@ -258,7 +258,7 @@ void zmq::fd_signaler_t::signal (int signal_)
|
|||||||
errno_assert (nbytes == 1);
|
errno_assert (nbytes == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::poll ()
|
uint64_t zmq::signaler_t::poll ()
|
||||||
{
|
{
|
||||||
// Set the reader to blocking mode.
|
// Set the reader to blocking mode.
|
||||||
int flags = fcntl (r, F_GETFL, 0);
|
int flags = fcntl (r, F_GETFL, 0);
|
||||||
@@ -280,7 +280,7 @@ uint64_t zmq::fd_signaler_t::poll ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::check ()
|
uint64_t zmq::signaler_t::check ()
|
||||||
{
|
{
|
||||||
unsigned char buffer [64];
|
unsigned char buffer [64];
|
||||||
ssize_t nbytes = recv (r, buffer, 64, 0);
|
ssize_t nbytes = recv (r, buffer, 64, 0);
|
||||||
@@ -296,7 +296,7 @@ uint64_t zmq::fd_signaler_t::check ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
zmq::fd_t zmq::signaler_t::get_fd ()
|
||||||
{
|
{
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
zmq::fd_signaler_t::fd_signaler_t ()
|
zmq::signaler_t::signaler_t ()
|
||||||
{
|
{
|
||||||
int sv [2];
|
int sv [2];
|
||||||
int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
|
int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
|
||||||
@@ -315,13 +315,13 @@ zmq::fd_signaler_t::fd_signaler_t ()
|
|||||||
r = sv [1];
|
r = sv [1];
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_signaler_t::~fd_signaler_t ()
|
zmq::signaler_t::~signaler_t ()
|
||||||
{
|
{
|
||||||
close (w);
|
close (w);
|
||||||
close (r);
|
close (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::fd_signaler_t::signal (int signal_)
|
void zmq::signaler_t::signal (int signal_)
|
||||||
{
|
{
|
||||||
// TODO: Note that send is a blocking operation.
|
// TODO: Note that send is a blocking operation.
|
||||||
// How should we behave if the signal cannot be written to the signaler?
|
// How should we behave if the signal cannot be written to the signaler?
|
||||||
@@ -332,7 +332,7 @@ void zmq::fd_signaler_t::signal (int signal_)
|
|||||||
errno_assert (nbytes == 1);
|
errno_assert (nbytes == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::poll ()
|
uint64_t zmq::signaler_t::poll ()
|
||||||
{
|
{
|
||||||
unsigned char buffer [64];
|
unsigned char buffer [64];
|
||||||
ssize_t nbytes = recv (r, buffer, 64, 0);
|
ssize_t nbytes = recv (r, buffer, 64, 0);
|
||||||
@@ -346,7 +346,7 @@ uint64_t zmq::fd_signaler_t::poll ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t zmq::fd_signaler_t::check ()
|
uint64_t zmq::signaler_t::check ()
|
||||||
{
|
{
|
||||||
unsigned char buffer [64];
|
unsigned char buffer [64];
|
||||||
ssize_t nbytes = recv (r, buffer, 64, MSG_DONTWAIT);
|
ssize_t nbytes = recv (r, buffer, 64, MSG_DONTWAIT);
|
||||||
@@ -362,7 +362,7 @@ uint64_t zmq::fd_signaler_t::check ()
|
|||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
zmq::fd_t zmq::signaler_t::get_fd ()
|
||||||
{
|
{
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ zmq::fd_t zmq::fd_signaler_t::get_fd ()
|
|||||||
|
|
||||||
#if defined ZMQ_HAVE_OPENVMS
|
#if defined ZMQ_HAVE_OPENVMS
|
||||||
|
|
||||||
int zmq::fd_signaler_t::socketpair (int domain_, int type_, int protocol_,
|
int zmq::signaler_t::socketpair (int domain_, int type_, int protocol_,
|
||||||
int sv_ [2])
|
int sv_ [2])
|
||||||
{
|
{
|
||||||
int listener;
|
int listener;
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ZMQ_FD_SIGNALER_HPP_INCLUDED__
|
#ifndef __ZMQ_SIGNALER_HPP_INCLUDED__
|
||||||
#define __ZMQ_FD_SIGNALER_HPP_INCLUDED__
|
#define __ZMQ_SIGNALER_HPP_INCLUDED__
|
||||||
|
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include "fd.hpp"
|
#include "fd.hpp"
|
||||||
@@ -32,12 +32,12 @@ namespace zmq
|
|||||||
// descriptor and so it can be polled on. Same signal cannot be sent twice
|
// descriptor and so it can be polled on. Same signal cannot be sent twice
|
||||||
// unless signals are retrieved by the reader side in the meantime.
|
// unless signals are retrieved by the reader side in the meantime.
|
||||||
|
|
||||||
class fd_signaler_t
|
class signaler_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
fd_signaler_t ();
|
signaler_t ();
|
||||||
~fd_signaler_t ();
|
~signaler_t ();
|
||||||
|
|
||||||
// i_signaler interface implementation.
|
// i_signaler interface implementation.
|
||||||
void signal (int signal_);
|
void signal (int signal_);
|
||||||
@@ -71,8 +71,8 @@ namespace zmq
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable copying of fd_signeler object.
|
// Disable copying of fd_signeler object.
|
||||||
fd_signaler_t (const fd_signaler_t&);
|
signaler_t (const signaler_t&);
|
||||||
void operator = (const fd_signaler_t&);
|
void operator = (const signaler_t&);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user