summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-04-29 17:31:57 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-04-29 17:31:57 +0200
commit37128b7b1aeed9ad2bf6816560b85b5f94dd5bec (patch)
tree41c1147b83feccf5f495f004e3b48952b8756271 /src
parentc193fd146661b39027c5e3fa0776dcdf8c6af5e2 (diff)
fd_signaler_t renamed to signaler_t
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/app_thread.cpp3
-rw-r--r--src/app_thread.hpp6
-rw-r--r--src/dispatcher.hpp4
-rw-r--r--src/io_thread.cpp2
-rw-r--r--src/io_thread.hpp6
-rw-r--r--src/signaler.cpp (renamed from src/fd_signaler.cpp)52
-rw-r--r--src/signaler.hpp (renamed from src/fd_signaler.hpp)14
8 files changed, 45 insertions, 46 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 837cd5f..2cd5ace 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 \
diff --git a/src/app_thread.cpp b/src/app_thread.cpp
index 0dad660..10068c0 100644
--- a/src/app_thread.cpp
+++ b/src/app_thread.cpp
@@ -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;
}
diff --git a/src/app_thread.hpp b/src/app_thread.hpp
index b7572da..2bca757 100644
--- a/src/app_thread.hpp
+++ b/src/app_thread.hpp
@@ -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;
diff --git a/src/dispatcher.hpp b/src/dispatcher.hpp
index 6648f5d..ff08abc 100644
--- a/src/dispatcher.hpp
+++ b/src/dispatcher.hpp
@@ -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,
diff --git a/src/io_thread.cpp b/src/io_thread.cpp
index 41f7f7d..7d997ad 100644
--- a/src/io_thread.cpp
+++ b/src/io_thread.cpp
@@ -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;
}
diff --git a/src/io_thread.hpp b/src/io_thread.hpp
index 84b9319..deb03a1 100644
--- a/src/io_thread.hpp
+++ b/src/io_thread.hpp
@@ -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;
diff --git a/src/fd_signaler.cpp b/src/signaler.cpp
index 653f36d..a98f1fe 100644
--- a/src/fd_signaler.cpp
+++ b/src/signaler.cpp
@@ -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;
diff --git a/src/fd_signaler.hpp b/src/signaler.hpp
index a6ccbba..29f2ff6 100644
--- a/src/fd_signaler.hpp
+++ b/src/signaler.hpp
@@ -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&);
};
}