0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-31 01:43:02 +08:00

fd_signaler_t renamed to signaler_t

This commit is contained in:
Martin Sustrik 2010-04-29 17:31:57 +02:00
parent c193fd1466
commit 37128b7b1a
8 changed files with 45 additions and 46 deletions

View File

@ -63,7 +63,6 @@ libzmq_la_SOURCES = app_thread.hpp \
epoll.hpp \
err.hpp \
fd.hpp \
fd_signaler.hpp \
forwarder.hpp \
fq.hpp \
i_inout.hpp \
@ -96,6 +95,7 @@ libzmq_la_SOURCES = app_thread.hpp \
req.hpp \
select.hpp \
session.hpp \
signaler.hpp \
socket_base.hpp \
stdint.hpp \
streamer.hpp \
@ -127,7 +127,6 @@ libzmq_la_SOURCES = app_thread.hpp \
downstream.cpp \
epoll.cpp \
err.cpp \
fd_signaler.cpp \
forwarder.cpp \
fq.cpp \
io_object.cpp \
@ -151,6 +150,7 @@ libzmq_la_SOURCES = app_thread.hpp \
req.cpp \
select.cpp \
session.cpp \
signaler.cpp \
socket_base.cpp \
streamer.cpp \
sub.cpp \

View File

@ -35,7 +35,6 @@
#include "app_thread.hpp"
#include "dispatcher.hpp"
#include "fd_signaler.hpp"
#include "err.hpp"
#include "pipe.hpp"
#include "config.hpp"
@ -75,7 +74,7 @@ void zmq::app_thread_t::stop ()
send_stop ();
}
zmq::fd_signaler_t *zmq::app_thread_t::get_signaler ()
zmq::signaler_t *zmq::app_thread_t::get_signaler ()
{
return &signaler;
}

View File

@ -25,7 +25,7 @@
#include "stdint.hpp"
#include "object.hpp"
#include "yarray.hpp"
#include "fd_signaler.hpp"
#include "signaler.hpp"
namespace zmq
{
@ -43,7 +43,7 @@ namespace zmq
void stop ();
// 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
// set to true, returns only after at least one command was processed.
@ -71,7 +71,7 @@ namespace zmq
sockets_t sockets;
// App thread's signaler object.
fd_signaler_t signaler;
signaler_t signaler;
// Timestamp of when commands were processed the last time.
uint64_t last_processing_time;

View File

@ -25,7 +25,7 @@
#include <map>
#include <string>
#include "fd_signaler.hpp"
#include "signaler.hpp"
#include "ypipe.hpp"
#include "command.hpp"
#include "config.hpp"
@ -125,7 +125,7 @@ namespace zmq
io_threads_t io_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.
typedef ypipe_t <command_t, true,

View File

@ -54,7 +54,7 @@ void zmq::io_thread_t::stop ()
send_stop ();
}
zmq::fd_signaler_t *zmq::io_thread_t::get_signaler ()
zmq::signaler_t *zmq::io_thread_t::get_signaler ()
{
return &signaler;
}

View File

@ -26,7 +26,7 @@
#include "object.hpp"
#include "poller.hpp"
#include "i_poll_events.hpp"
#include "fd_signaler.hpp"
#include "signaler.hpp"
namespace zmq
{
@ -51,7 +51,7 @@ namespace zmq
void stop ();
// Returns signaler associated with this I/O thread.
fd_signaler_t *get_signaler ();
signaler_t *get_signaler ();
// i_poll_events implementation.
void in_event ();
@ -71,7 +71,7 @@ namespace zmq
// Poll thread gets notifications about incoming commands using
// this signaler.
fd_signaler_t signaler;
signaler_t signaler;
// Handle associated with signaler's file descriptor.
poller_t::handle_t signaler_handle;

View File

@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "fd_signaler.hpp"
#include "signaler.hpp"
#include "platform.hpp"
#include "err.hpp"
#include "fd.hpp"
@ -36,7 +36,7 @@
#include <sys/eventfd.h>
zmq::fd_signaler_t::fd_signaler_t ()
zmq::signaler_t::signaler_t ()
{
// Create eventfd object.
fd = eventfd (0, 0);
@ -50,13 +50,13 @@ zmq::fd_signaler_t::fd_signaler_t ()
errno_assert (rc != -1);
}
zmq::fd_signaler_t::~fd_signaler_t ()
zmq::signaler_t::~signaler_t ()
{
int rc = close (fd);
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);
uint64_t inc = 1;
@ -65,7 +65,7 @@ void zmq::fd_signaler_t::signal (int signal_)
errno_assert (sz == sizeof (uint64_t));
}
uint64_t zmq::fd_signaler_t::poll ()
uint64_t zmq::signaler_t::poll ()
{
// Set to blocking mode.
int flags = fcntl (fd, F_GETFL, 0);
@ -93,7 +93,7 @@ uint64_t zmq::fd_signaler_t::poll ()
return signals;
}
uint64_t zmq::fd_signaler_t::check ()
uint64_t zmq::signaler_t::check ()
{
uint64_t signals;
ssize_t sz = read (fd, &signals, sizeof (uint64_t));
@ -103,14 +103,14 @@ uint64_t zmq::fd_signaler_t::check ()
return signals;
}
zmq::fd_t zmq::fd_signaler_t::get_fd ()
zmq::fd_t zmq::signaler_t::get_fd ()
{
return fd;
}
#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
// 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);
}
zmq::fd_signaler_t::~fd_signaler_t ()
zmq::signaler_t::~signaler_t ()
{
int rc = closesocket (w);
wsa_assert (rc != SOCKET_ERROR);
@ -171,7 +171,7 @@ zmq::fd_signaler_t::~fd_signaler_t ()
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.
// 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);
}
uint64_t zmq::fd_signaler_t::poll ()
uint64_t zmq::signaler_t::poll ()
{
// Switch to blocking mode.
unsigned long argp = 0;
@ -202,7 +202,7 @@ uint64_t zmq::fd_signaler_t::poll ()
return signals;
}
uint64_t zmq::fd_signaler_t::check ()
uint64_t zmq::signaler_t::check ()
{
unsigned char buffer [32];
int nbytes = recv (r, (char*) buffer, 32, 0);
@ -218,7 +218,7 @@ uint64_t zmq::fd_signaler_t::check ()
return signals;
}
zmq::fd_t zmq::fd_signaler_t::get_fd ()
zmq::fd_t zmq::signaler_t::get_fd ()
{
return r;
}
@ -228,7 +228,7 @@ zmq::fd_t zmq::fd_signaler_t::get_fd ()
#include <sys/types.h>
#include <sys/socket.h>
zmq::fd_signaler_t::fd_signaler_t ()
zmq::signaler_t::signaler_t ()
{
int sv [2];
int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
@ -244,13 +244,13 @@ zmq::fd_signaler_t::fd_signaler_t ()
errno_assert (rc != -1);
}
zmq::fd_signaler_t::~fd_signaler_t ()
zmq::signaler_t::~signaler_t ()
{
close (w);
close (r);
}
void zmq::fd_signaler_t::signal (int signal_)
void zmq::signaler_t::signal (int signal_)
{
zmq_assert (signal_ >= 0 && signal_ < 64);
unsigned char c = (unsigned char) signal_;
@ -258,7 +258,7 @@ void zmq::fd_signaler_t::signal (int signal_)
errno_assert (nbytes == 1);
}
uint64_t zmq::fd_signaler_t::poll ()
uint64_t zmq::signaler_t::poll ()
{
// Set the reader to blocking mode.
int flags = fcntl (r, F_GETFL, 0);
@ -280,7 +280,7 @@ uint64_t zmq::fd_signaler_t::poll ()
return signals;
}
uint64_t zmq::fd_signaler_t::check ()
uint64_t zmq::signaler_t::check ()
{
unsigned char buffer [64];
ssize_t nbytes = recv (r, buffer, 64, 0);
@ -296,7 +296,7 @@ uint64_t zmq::fd_signaler_t::check ()
return signals;
}
zmq::fd_t zmq::fd_signaler_t::get_fd ()
zmq::fd_t zmq::signaler_t::get_fd ()
{
return r;
}
@ -306,7 +306,7 @@ zmq::fd_t zmq::fd_signaler_t::get_fd ()
#include <sys/types.h>
#include <sys/socket.h>
zmq::fd_signaler_t::fd_signaler_t ()
zmq::signaler_t::signaler_t ()
{
int sv [2];
int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
@ -315,13 +315,13 @@ zmq::fd_signaler_t::fd_signaler_t ()
r = sv [1];
}
zmq::fd_signaler_t::~fd_signaler_t ()
zmq::signaler_t::~signaler_t ()
{
close (w);
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.
// 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);
}
uint64_t zmq::fd_signaler_t::poll ()
uint64_t zmq::signaler_t::poll ()
{
unsigned char buffer [64];
ssize_t nbytes = recv (r, buffer, 64, 0);
@ -346,7 +346,7 @@ uint64_t zmq::fd_signaler_t::poll ()
return signals;
}
uint64_t zmq::fd_signaler_t::check ()
uint64_t zmq::signaler_t::check ()
{
unsigned char buffer [64];
ssize_t nbytes = recv (r, buffer, 64, MSG_DONTWAIT);
@ -362,7 +362,7 @@ uint64_t zmq::fd_signaler_t::check ()
return signals;
}
zmq::fd_t zmq::fd_signaler_t::get_fd ()
zmq::fd_t zmq::signaler_t::get_fd ()
{
return r;
}
@ -371,7 +371,7 @@ zmq::fd_t zmq::fd_signaler_t::get_fd ()
#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 listener;

View File

@ -17,8 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_FD_SIGNALER_HPP_INCLUDED__
#define __ZMQ_FD_SIGNALER_HPP_INCLUDED__
#ifndef __ZMQ_SIGNALER_HPP_INCLUDED__
#define __ZMQ_SIGNALER_HPP_INCLUDED__
#include "platform.hpp"
#include "fd.hpp"
@ -32,12 +32,12 @@ namespace zmq
// 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.
class fd_signaler_t
class signaler_t
{
public:
fd_signaler_t ();
~fd_signaler_t ();
signaler_t ();
~signaler_t ();
// i_signaler interface implementation.
void signal (int signal_);
@ -71,8 +71,8 @@ namespace zmq
#endif
// Disable copying of fd_signeler object.
fd_signaler_t (const fd_signaler_t&);
void operator = (const fd_signaler_t&);
signaler_t (const signaler_t&);
void operator = (const signaler_t&);
};
}