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
082b6aa6
Commit
082b6aa6
authored
May 23, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: epoll not supported under Windows
Solution: Use wepoll on Windows
parent
c62df64b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
13 deletions
+40
-13
CMakeLists.txt
CMakeLists.txt
+8
-7
epoll.cpp
src/epoll.cpp
+15
-5
epoll.hpp
src/epoll.hpp
+17
-1
No files found.
CMakeLists.txt
View file @
082b6aa6
...
...
@@ -182,6 +182,11 @@ else ()
message
(
FATAL_ERROR
"Invalid polling method"
)
endif
()
if
(
POLLER STREQUAL
"epoll"
AND WIN32
)
message
(
STATUS
"Including wepoll"
)
list
(
APPEND sources
${
CMAKE_CURRENT_SOURCE_DIR
}
/external/wepoll/wepoll.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/external/wepoll/wepoll.h
)
endif
()
if
(
API_POLLER STREQUAL
""
)
if
(
POLLER STREQUAL
"select"
)
set
(
API_POLLER
"select"
)
...
...
@@ -886,8 +891,9 @@ endif ()
if
(
MSVC
)
# default for all sources is to use precompiled headers
foreach
(
source
${
sources
}
)
if
(
NOT
${
source
}
STREQUAL
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/precompiled.cpp"
)
foreach
(
source
${
sources
}
)
# C and C++ can not use the same precompiled header
if
(
${
soruce
}
MATCHES
".cpp$"
AND NOT
${
source
}
STREQUAL
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/precompiled.cpp"
)
set_source_files_properties
(
${
source
}
PROPERTIES
COMPILE_FLAGS
"/Yuprecompiled.hpp"
...
...
@@ -901,11 +907,6 @@ if (MSVC)
COMPILE_FLAGS
"/Ycprecompiled.hpp"
OBJECT_OUTPUTS precompiled.hpp
)
# C and C++ can not use the same precompiled header
set_source_files_properties
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/tweetnacl.c
PROPERTIES
COMPILE_FLAGS
"/Y-"
)
endif
()
...
...
src/epoll.cpp
View file @
082b6aa6
...
...
@@ -28,23 +28,29 @@
*/
#include "precompiled.hpp"
#include "epoll.hpp"
#if defined ZMQ_IOTHREAD_POLLER_USE_EPOLL
#include "epoll.hpp"
#if !defined ZMQ_HAVE_WINDOWS
#include <unistd.h>
#endif
#include <sys/epoll.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <algorithm>
#include <new>
#include "macros.hpp"
#include "epoll.hpp"
#include "err.hpp"
#include "config.hpp"
#include "i_poll_events.hpp"
#ifdef ZMQ_HAVE_WINDOWS
const
zmq
::
epoll_t
::
epoll_fd_t
zmq
::
epoll_t
::
epoll_retired_fd
=
INVALID_HANDLE_VALUE
;
#endif
zmq
::
epoll_t
::
epoll_t
(
const
zmq
::
thread_ctx_t
&
ctx_
)
:
worker_poller_base_t
(
ctx_
)
{
...
...
@@ -56,7 +62,7 @@ zmq::epoll_t::epoll_t (const zmq::thread_ctx_t &ctx_) :
#else
epoll_fd
=
epoll_create
(
1
);
#endif
errno_assert
(
epoll_fd
!=
-
1
);
errno_assert
(
epoll_fd
!=
epoll_retired_fd
);
}
zmq
::
epoll_t
::~
epoll_t
()
...
...
@@ -64,7 +70,11 @@ zmq::epoll_t::~epoll_t ()
// Wait till the worker thread exits.
stop_worker
();
#ifdef ZMQ_HAVE_WINDOWS
epoll_close
(
epoll_fd
);
#else
close
(
epoll_fd
);
#endif
for
(
retired_t
::
iterator
it
=
retired
.
begin
();
it
!=
retired
.
end
();
++
it
)
{
LIBZMQ_DELETE
(
*
it
);
...
...
src/epoll.hpp
View file @
082b6aa6
...
...
@@ -35,7 +35,12 @@
#if defined ZMQ_IOTHREAD_POLLER_USE_EPOLL
#include <vector>
#if defined ZMQ_HAVE_WINDOWS
#include "../external/wepoll/wepoll.h"
#else
#include <sys/epoll.h>
#endif
#include "ctx.hpp"
#include "fd.hpp"
...
...
@@ -70,11 +75,22 @@ class epoll_t : public worker_poller_base_t
static
int
max_fds
();
private
:
#if defined ZMQ_HAVE_WINDOWS
typedef
HANDLE
epoll_fd_t
;
static
const
epoll_fd_t
epoll_retired_fd
;
#else
typedef
fd_t
epoll_fd_t
;
enum
{
epoll_retired_fd
=
retired_fd
};
#endif
// Main event loop.
void
loop
();
// Main epoll file descriptor
fd_t
epoll_fd
;
epoll_
fd_t
epoll_fd
;
struct
poll_entry_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