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
7f22995e
Commit
7f22995e
authored
Dec 11, 2013
by
KIU Shueng Chuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use mutex implementation if fixed signaler_port!=5905
parent
b4395d15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
signaler.cpp
src/signaler.cpp
+26
-3
No files found.
src/signaler.cpp
View file @
7f22995e
...
...
@@ -69,6 +69,7 @@
#if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#include <tchar.h>
#else
#include <unistd.h>
#include <netinet/tcp.h>
...
...
@@ -309,7 +310,11 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
HANDLE
sync
=
NULL
;
// Create critical section only if using fixed signaler port
if
(
signaler_port
!=
0
)
{
// Use problematic Event implementation for compatibility if using old port 5905.
// Otherwise use Mutex implementation.
int
event_signaler_port
=
5905
;
if
(
signaler_port
==
event_signaler_port
)
{
# if !defined _WIN32_WCE
sync
=
CreateEvent
(
&
sa
,
FALSE
,
TRUE
,
TEXT
(
"Global
\\
zmq-signaler-port-sync"
));
# else
...
...
@@ -321,6 +326,20 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
win_assert
(
sync
!=
NULL
);
}
else
if
(
signaler_port
!=
0
)
{
TCHAR
mutex_name
[
64
];
_stprintf
(
mutex_name
,
TEXT
(
"Global
\\
zmq-signaler-port-%d"
),
signaler_port
);
# if !defined _WIN32_WCE
sync
=
CreateMutex
(
&
sa
,
FALSE
,
mutex_name
);
# else
sync
=
CreateMutex
(
NULL
,
FALSE
,
mutex_name
);
# endif
if
(
sync
==
NULL
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
)
sync
=
OpenMutex
(
SYNCHRONIZE
,
FALSE
,
mutex_name
);
win_assert
(
sync
!=
NULL
);
}
// Windows has no 'socketpair' function. CreatePipe is no good as pipe
// handles cannot be polled on. Here we create the socketpair by hand.
...
...
@@ -361,7 +380,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
if
(
sync
!=
NULL
)
{
// Enter the critical section.
DWORD
dwrc
=
WaitForSingleObject
(
sync
,
INFINITE
);
zmq_assert
(
dwrc
==
WAIT_OBJECT_0
);
zmq_assert
(
dwrc
==
WAIT_OBJECT_0
||
dwrc
==
WAIT_ABANDONED
);
}
// Bind listening socket to signaler port.
...
...
@@ -395,7 +414,11 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
if
(
sync
!=
NULL
)
{
// Exit the critical section.
BOOL
brc
=
SetEvent
(
sync
);
BOOL
brc
;
if
(
signaler_port
==
event_signaler_port
)
brc
=
SetEvent
(
sync
);
else
brc
=
ReleaseMutex
(
sync
);
win_assert
(
brc
!=
0
);
// Release the kernel object
...
...
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