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
5a897f75
Commit
5a897f75
authored
Feb 12, 2015
by
somdoron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allocate reaper_signal only when needed
parent
bbdd8662
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
socket_base.cpp
src/socket_base.cpp
+16
-5
socket_base.hpp
src/socket_base.hpp
+1
-1
No files found.
src/socket_base.cpp
View file @
5a897f75
...
...
@@ -161,7 +161,8 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool
file_desc
(
-
1
),
monitor_socket
(
NULL
),
monitor_events
(
0
),
thread_safe
(
thread_safe_
)
thread_safe
(
thread_safe_
),
reaper_signaler
(
NULL
)
{
options
.
socket_id
=
sid_
;
options
.
ipv6
=
(
parent_
->
get
(
ZMQ_IPV6
)
!=
0
);
...
...
@@ -171,12 +172,15 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool
mailbox
=
new
mailbox_safe_t
(
&
sync
);
else
mailbox
=
new
mailbox_t
();
}
zmq
::
socket_base_t
::~
socket_base_t
()
{
delete
mailbox
;
if
(
reaper_signaler
)
delete
reaper_signaler
;
stop_monitor
();
zmq_assert
(
destroyed
);
}
...
...
@@ -1111,12 +1115,14 @@ void zmq::socket_base_t::start_reaping (poller_t *poller_)
else
{
ENTER_MUTEX
();
reaper_signaler
=
new
signaler_t
();
// Add signaler to the safe mailbox
fd
=
reaper_signaler
.
get_fd
();
((
mailbox_safe_t
*
)
mailbox
)
->
add_signaler
(
&
reaper_signaler
);
fd
=
reaper_signaler
->
get_fd
();
((
mailbox_safe_t
*
)
mailbox
)
->
add_signaler
(
reaper_signaler
);
// Send a signal to make sure reaper handle existing commands
reaper_signaler
.
send
();
reaper_signaler
->
send
();
EXIT_MUTEX
();
}
...
...
@@ -1277,6 +1283,11 @@ void zmq::socket_base_t::in_event ()
// be destroyed.
ENTER_MUTEX
();
// If the socket is thread safe we need to unsignal the reaper signaler
if
(
thread_safe
)
reaper_signaler
->
recv
();
process_commands
(
0
,
false
);
EXIT_MUTEX
();
check_destroy
();
...
...
src/socket_base.hpp
View file @
5a897f75
...
...
@@ -261,7 +261,7 @@ namespace zmq
bool
thread_safe
;
// Signaler to be used in the reaping stage
signaler_t
reaper_signaler
;
signaler_t
*
reaper_signaler
;
// Mutex for synchronize access to the socket in thread safe mode
mutex_t
sync
;
...
...
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