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
5bae6911
Commit
5bae6911
authored
Aug 17, 2015
by
somdoron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove poller field, using fd instead
parent
9d829f72
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
zmq.h
include/zmq.h
+6
-1
zmq.cpp
src/zmq.cpp
+9
-6
test_thread_safe_polling.cpp
tests/test_thread_safe_polling.cpp
+3
-9
No files found.
include/zmq.h
View file @
5bae6911
...
...
@@ -405,7 +405,6 @@ typedef struct zmq_pollitem_t
#endif
short
events
;
short
revents
;
void
*
poller
;
}
zmq_pollitem_t
;
#define ZMQ_POLLITEMS_DFLT 16
...
...
@@ -414,6 +413,12 @@ ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
ZMQ_EXPORT
void
*
zmq_poller_new
();
ZMQ_EXPORT
int
zmq_poller_close
(
void
*
p
);
#if defined _WIN32
ZMQ_EXPORT
SOCKET
zmq_poller_fd
(
void
*
p
);
#else
ZMQ_EXPORT
int
zmq_poller_fd
(
void
*
p
);
#endif
/******************************************************************************/
/* Message proxying */
/******************************************************************************/
...
...
src/zmq.cpp
View file @
5bae6911
...
...
@@ -727,8 +727,11 @@ int zmq_poller_close (void* p)
}
// Get poller fd
zmq
::
fd_t
zmq_poller_get_fd
(
void
*
p
)
#if defined _WIN32
SOCKET
zmq_poller_fd
(
void
*
p
)
#else
int
zmq_poller_fd
(
void
*
p
)
#endif
{
zmq
::
signaler_t
*
s
=
(
zmq
::
signaler_t
*
)
p
;
return
s
->
get_fd
();
...
...
@@ -790,14 +793,14 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
}
if
(
thread_safe
)
{
if
(
!
items_
[
i
].
poller
)
{
if
(
!
items_
[
i
].
fd
)
{
if
(
pollfds
!=
spollfds
)
free
(
pollfds
);
errno
=
EINVAL
;
return
-
1
;
}
pollfds
[
i
].
fd
=
zmq_poller_get_fd
(
items_
[
i
].
poller
)
;
pollfds
[
i
].
fd
=
items_
[
i
].
fd
;
}
else
{
size_t
zmq_fd_size
=
sizeof
(
zmq
::
fd_t
);
...
...
@@ -974,12 +977,12 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
zmq
::
fd_t
notify_fd
;
if
(
thread_safe
)
{
if
(
!
items_
[
i
].
poller
)
{
if
(
!
items_
[
i
].
fd
)
{
errno
=
EINVAL
;
return
-
1
;
}
notify_fd
=
zmq_poller_get_fd
(
items_
[
i
].
poller
)
;
notify_fd
=
items_
[
i
].
fd
;
}
else
{
size_t
zmq_fd_size
=
sizeof
(
zmq
::
fd_t
);
...
...
tests/test_thread_safe_polling.cpp
View file @
5bae6911
...
...
@@ -49,15 +49,9 @@ int main (void)
rc
=
zmq_add_poller
(
server2
,
poller
);
assert
(
rc
==
0
);
zmq_pollitem_t
items
[
2
];
items
[
0
].
socket
=
server
;
items
[
0
].
poller
=
poller
;
items
[
0
].
events
=
ZMQ_POLLIN
;
items
[
1
].
socket
=
server2
;
items
[
1
].
poller
=
poller
;
items
[
1
].
events
=
ZMQ_POLLIN
;
zmq_pollitem_t
items
[]
=
{
{
server
,
zmq_poller_fd
(
poller
),
ZMQ_POLLIN
,
0
},
{
server2
,
zmq_poller_fd
(
poller
),
ZMQ_POLLIN
,
0
}};
rc
=
zmq_bind
(
server
,
"tcp://127.0.0.1:5560"
);
assert
(
rc
==
0
);
...
...
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