Conversation
The event loop interface selected libevent on Windows when no Unix\nbackend applied. Replace that implicit fallback with a native\nWinSock-based backend so the core event loop no longer depends on\nlibevent for Windows builds by default.\n\nThe new backend keeps the existing mk_event interface semantics for\nreadable sockets, notification channels, timer delivery, and injected\nevents. Update the build selection logic so Windows defaults to the\nnative backend and only builds libevent when it is requested\nexplicitly.\n\nAdd unit coverage for the public event loop interface, including\nchannel notifications, add/wait/delete flow, duplicate-safe injection,\nand timeout delivery.\n\nVerified with:\n- cmake -S . -B build -DMK_TESTS=ON\n- cmake --build build\n- ./build/bin/mk-test-event_loop\n- ./build/bin/mk-test-event_timeout\n- ./build/bin/mk-test-lib_server Signed-off-by: Eduardo Silva <edsiper@gmail.com>
The native Windows event loop backend removed the libevent build\nrequirement, but mk_fifo still included event.h and used\nevutil_socketpair() on Windows. Replace that path with a native socket\npair helper so the server code builds without libevent headers.\n\nAlso update the pthread_once callback prototype in mk_server/monkey.c\nto use an explicit void parameter list, which avoids the MSVC C4113\nwarning during Windows builds.\n\nVerified with:\n- cmake --build build --target monkey-core-static\n- cmake --build build --target mk-test-lib_server\n- cmake --build build --target mk-test-event_loop\n- cmake --build build --target mk-test-event_timeout Signed-off-by: Eduardo Silva <edsiper@gmail.com>
cosmo0920
reviewed
May 14, 2026
|
|
||
| static LONG win32_wsa_initialized = 0; | ||
|
|
||
| static int win32_socketpair(SOCKET pair[2]) |
Contributor
There was a problem hiding this comment.
Since Windows 10 1803, we can use AF_UNIX on Windows with including afunix.h like:
#ifdef EVENT__HAVE_AFUNIX_H
#include <afunix.h>
#endif
/* ... */
SOCKET s = socket(AF_UNIX, SOCK_STREAM, 0);
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
strcpy_s(addr.sun_path, sizeof(addr.sun_path), "C:\\Temp\\xxx.sock");For further information, we can refer the following links:
https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
Contributor
There was a problem hiding this comment.
Or, we can include this type of changes in libevent to monkey event system:
libevent/libevent#913
cosmo0920
suggested changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests Added
Added unit coverage for the public event loop interface, including:
Verification
cmake -S . -B build -DMK_TESTS=ON
cmake --build build
./build/bin/mk-test-event_loop
./build/bin/mk-test-event_timeout
./build/bin/mk-test-lib_server