Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
37128b7b
Commit
37128b7b
authored
Apr 29, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fd_signaler_t renamed to signaler_t
parent
c193fd14
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
46 deletions
+45
-46
Makefile.am
src/Makefile.am
+2
-2
app_thread.cpp
src/app_thread.cpp
+1
-2
app_thread.hpp
src/app_thread.hpp
+3
-3
dispatcher.hpp
src/dispatcher.hpp
+2
-2
io_thread.cpp
src/io_thread.cpp
+1
-1
io_thread.hpp
src/io_thread.hpp
+3
-3
signaler.cpp
src/signaler.cpp
+26
-26
signaler.hpp
src/signaler.hpp
+7
-7
No files found.
src/Makefile.am
View file @
37128b7b
...
...
@@ -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
\
...
...
src/app_thread.cpp
View file @
37128b7b
...
...
@@ -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
;
}
...
...
src/app_thread.hpp
View file @
37128b7b
...
...
@@ -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
;
...
...
src/dispatcher.hpp
View file @
37128b7b
...
...
@@ -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
,
...
...
src/io_thread.cpp
View file @
37128b7b
...
...
@@ -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
;
}
...
...
src/io_thread.hpp
View file @
37128b7b
...
...
@@ -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
;
...
...
src/
fd_
signaler.cpp
→
src/signaler.cpp
View file @
37128b7b
...
...
@@ -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
;
...
...
src/
fd_
signaler.hpp
→
src/signaler.hpp
View file @
37128b7b
...
...
@@ -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
&
);
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment