Closed Be3y4uu-K0T closed 1 year ago
thank you for your try! I developed with macOS originally, but later I changed to docker using a Linux container, so the macOS version was broken.
int register_event_count_ { 1 }
; // FIXME: Is there a needed? With zero (0) faster than one (1).
in macOS that may be true, but in Linux the epoll_wait
needs the maxevents
argument must be greater than zero.
I'm very unsure if I did everything right, but it compiles, and that was the most important thing for me! Thank you for your time.
if ./test/ut/asyncio_ut
runs success, it may be right, and your test cases are plenitude.
could you package your modifications with a pull request?
Hello,
while I was building
asyncio
I have faced with many issues:In
asyncio/include/asyncio/selector/kqueue_selector.h
I finishedKQueueSelector
:I replaced this
std::vector<struct kevent> events_;
onint register_event_count_ { 1 };
because I don't know why this needThen I have faced with many issues again:
For MacOS we need to use
EVFILT_READ
/EVFILT_WRITE
instead ofEPOLLIN
/EPOLLOUT
. Inasyncio/include/asyncio/selector/event.h
I addedenum class Flags: int16_t
and renamedevents
toflags
:Then replace
events
toflags
in:epoll_selector.h::45
--epoll_event ev{ .events = event.flags, .data {.ptr = const_cast<HandleInfo*>(&event.handle_info) } };
epoll_selector.h::52
--epoll_event ev{ .events = event.flags };
open_connection.h::26
--Event ev { .fd = fd, .flags = Event::Flags::EVENT_WRITE };
start_server.h::33
--Event ev { .fd = fd_, .flags = Event::Flags::EVENT_READ };
stream.h::98-99
--Event read_ev_ { .fd = read_fd_, .flags = Event::Flags::EVENT_READ }; Event write_ev_ { .fd = write_fd_, .flags = Event::Flags::EVENT_WRITE };
And the last issues:
MacOS not supported
SOCK_NONBLOCK
, then I added intoasyncio/include/asyncio/stream.h
:start_server.h::87
open_connection.h::54
I tried to compile from the command line.
I just added into
asyncio/include/asyncio/event_loop.h
(link):All works!
Test 1
Test 2
```c++ // test2.cpp #includeTest 3
```c++ // test3.cpp #includeTest 4
```c++ // test4_echo_server.cpp #includeTest 5
```c++ // test5.cpp #includeTest 6
```c++ // test6.cpp #includeI'm very unsure if I did everything right, but it compiles, and that was the most important thing for me! Thank you for your time.
Links: