Skip to content

Commit

Permalink
Restore ability to build against upstream libev
Browse files Browse the repository at this point in the history
Make the usage of the local changes to libev only apply if using the
vendored version.

Fixes: phusion#1544
  • Loading branch information
terceiro committed May 6, 2022
1 parent 6a465f3 commit 7371279
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/common_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def define_libboost_oxt_task(namespace, output_dir, extra_compiler_flags = nil)
result = '-Isrc/cxx_supportlib/vendor-modified/libev'
# Apple Clang 4.2 complains about ambiguous member templates in ev++.h.
result << ' -Wno-ambiguous-member-template' if PlatformInfo.compiler_supports_wno_ambiguous_member_template?
result << '-DUSE_VENDORED_LIBEV'
result
end

Expand Down
4 changes: 4 additions & 0 deletions src/cxx_supportlib/BackgroundEventLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,15 @@ BackgroundEventLoop::BackgroundEventLoop(bool scalable, bool usesLibuv)
throw RuntimeException("Cannot create a libev event loop");
}

#ifdef USE_VENDORED_LIBEV
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_backend_fd(libev_loop), "libev event loop: backend FD");
#endif

ev_async_init(&priv->exitSignaller, signalLibevExit);
#ifdef USE_VENDORED_LIBEV
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(libev_loop, 0), "libev event loop: async pipe 0");
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(libev_loop, 1), "libev event loop: async pipe 1");
#endif
priv->exitSignaller.data = this;
safe = boost::make_shared<SafeLibev>(libev_loop);

Expand Down
2 changes: 2 additions & 0 deletions src/cxx_supportlib/SafeLibev.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ class SafeLibev {

~SafeLibev() {
destroy();
#ifdef USE_VENDORED_LIBEV
P_LOG_FILE_DESCRIPTOR_CLOSE(ev_loop_get_pipe(loop, 0));
P_LOG_FILE_DESCRIPTOR_CLOSE(ev_loop_get_pipe(loop, 1));
P_LOG_FILE_DESCRIPTOR_CLOSE(ev_backend_fd(loop));
#endif
ev_loop_destroy(loop);
}

Expand Down

0 comments on commit 7371279

Please sign in to comment.