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
d83b0453
Commit
d83b0453
authored
Aug 17, 2015
by
somdoron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename poller to pollfd
parent
5bae6911
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
23 deletions
+23
-23
zmq.h
include/zmq.h
+6
-6
zmq.cpp
src/zmq.cpp
+9
-9
test_thread_safe_polling.cpp
tests/test_thread_safe_polling.cpp
+8
-8
No files found.
include/zmq.h
View file @
d83b0453
...
...
@@ -383,8 +383,8 @@ ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags);
ZMQ_EXPORT
int
zmq_send_const
(
void
*
s
,
const
void
*
buf
,
size_t
len
,
int
flags
);
ZMQ_EXPORT
int
zmq_recv
(
void
*
s
,
void
*
buf
,
size_t
len
,
int
flags
);
ZMQ_EXPORT
int
zmq_socket_monitor
(
void
*
s
,
const
char
*
addr
,
int
events
);
ZMQ_EXPORT
int
zmq_add_poll
er
(
void
*
s
,
void
*
p
);
ZMQ_EXPORT
int
zmq_remove_poll
er
(
void
*
s
,
void
*
p
);
ZMQ_EXPORT
int
zmq_add_poll
fd
(
void
*
s
,
void
*
p
);
ZMQ_EXPORT
int
zmq_remove_poll
fd
(
void
*
s
,
void
*
p
);
/******************************************************************************/
/* I/O multiplexing. */
...
...
@@ -410,13 +410,13 @@ typedef struct zmq_pollitem_t
#define ZMQ_POLLITEMS_DFLT 16
ZMQ_EXPORT
int
zmq_poll
(
zmq_pollitem_t
*
items
,
int
nitems
,
long
timeout
);
ZMQ_EXPORT
void
*
zmq_poll
er
_new
();
ZMQ_EXPORT
int
zmq_poll
er
_close
(
void
*
p
);
ZMQ_EXPORT
void
*
zmq_poll
fd
_new
();
ZMQ_EXPORT
int
zmq_poll
fd
_close
(
void
*
p
);
#if defined _WIN32
ZMQ_EXPORT
SOCKET
zmq_poll
er
_fd
(
void
*
p
);
ZMQ_EXPORT
SOCKET
zmq_poll
fd
_fd
(
void
*
p
);
#else
ZMQ_EXPORT
int
zmq_poll
er
_fd
(
void
*
p
);
ZMQ_EXPORT
int
zmq_poll
fd
_fd
(
void
*
p
);
#endif
/******************************************************************************/
...
...
src/zmq.cpp
View file @
d83b0453
...
...
@@ -562,9 +562,9 @@ int zmq_recviov (void *s_, iovec *a_, size_t *count_, int flags_)
return
nread
;
}
// Add/remove poll
er
from a socket
// Add/remove poll
fd
from a socket
int
zmq_add_poll
er
(
void
*
s_
,
void
*
p_
)
int
zmq_add_poll
fd
(
void
*
s_
,
void
*
p_
)
{
if
(
!
s_
||
!
((
zmq
::
socket_base_t
*
)
s_
)
->
check_tag
())
{
errno
=
ENOTSOCK
;
...
...
@@ -576,7 +576,7 @@ int zmq_add_poller (void *s_, void *p_)
return
s
->
add_signaler
(
p
);
}
int
zmq_remove_poll
er
(
void
*
s_
,
void
*
p_
)
int
zmq_remove_poll
fd
(
void
*
s_
,
void
*
p_
)
{
if
(
!
s_
||
!
((
zmq
::
socket_base_t
*
)
s_
)
->
check_tag
())
{
errno
=
ENOTSOCK
;
...
...
@@ -709,16 +709,16 @@ const char *zmq_msg_gets (zmq_msg_t *msg_, const char *property_)
}
}
// Create poll
er
// Create poll
fd
void
*
zmq_poll
er
_new
()
void
*
zmq_poll
fd
_new
()
{
return
new
zmq
::
signaler_t
();
}
// Close poll
er
// Close poll
fd
int
zmq_poll
er
_close
(
void
*
p
)
int
zmq_poll
fd
_close
(
void
*
p
)
{
zmq
::
signaler_t
*
s
=
(
zmq
::
signaler_t
*
)
p
;
delete
s
;
...
...
@@ -728,9 +728,9 @@ int zmq_poller_close (void* p)
// Get poller fd
#if defined _WIN32
SOCKET
zmq_poll
er
_fd
(
void
*
p
)
SOCKET
zmq_poll
fd
_fd
(
void
*
p
)
#else
int
zmq_poll
er
_fd
(
void
*
p
)
int
zmq_poll
fd
_fd
(
void
*
p
)
#endif
{
zmq
::
signaler_t
*
s
=
(
zmq
::
signaler_t
*
)
p
;
...
...
tests/test_thread_safe_polling.cpp
View file @
d83b0453
...
...
@@ -39,19 +39,19 @@ int main (void)
void
*
server
=
zmq_socket
(
ctx
,
ZMQ_SERVER
);
void
*
server2
=
zmq_socket
(
ctx
,
ZMQ_SERVER
);
void
*
poll
er
=
zmq_poller
_new
();
void
*
poll
fd
=
zmq_pollfd
_new
();
int
rc
;
rc
=
zmq_add_poll
er
(
server
,
poller
);
rc
=
zmq_add_poll
fd
(
server
,
pollfd
);
assert
(
rc
==
0
);
rc
=
zmq_add_poll
er
(
server2
,
poller
);
rc
=
zmq_add_poll
fd
(
server2
,
pollfd
);
assert
(
rc
==
0
);
zmq_pollitem_t
items
[]
=
{
{
server
,
zmq_poll
er_fd
(
poller
),
ZMQ_POLLIN
,
0
},
{
server2
,
zmq_poll
er_fd
(
poller
),
ZMQ_POLLIN
,
0
}};
{
server
,
zmq_poll
fd_fd
(
pollfd
),
ZMQ_POLLIN
,
0
},
{
server2
,
zmq_poll
fd_fd
(
pollfd
),
ZMQ_POLLIN
,
0
}};
rc
=
zmq_bind
(
server
,
"tcp://127.0.0.1:5560"
);
assert
(
rc
==
0
);
...
...
@@ -94,13 +94,13 @@ int main (void)
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_remove_poll
er
(
server
,
poller
);
rc
=
zmq_remove_poll
fd
(
server
,
pollfd
);
assert
(
rc
==
0
);
rc
=
zmq_remove_poll
er
(
server2
,
poller
);
rc
=
zmq_remove_poll
fd
(
server2
,
pollfd
);
assert
(
rc
==
0
);
rc
=
zmq_poll
er_close
(
poller
);
rc
=
zmq_poll
fd_close
(
pollfd
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
server
);
...
...
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