Skip to content

Commit cdf853a

Browse files
authored
Update the wepoll library (#98)
1 parent ee04127 commit cdf853a

File tree

4 files changed

+470
-365
lines changed

4 files changed

+470
-365
lines changed

License

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Trantor - A non-blocking I/O based TCP network library, using C++14/17,
2-
// Copyright (c) 2016, Tao An. All rights reserved.
2+
// Copyright (c) 2016-2020, Tao An. All rights reserved.
33
// https://github.com/an-tao/trantor
44
//
55
// Redistribution and use in source and binary forms, with or without

third_party/wepoll/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## wepoll
2+
3+
This library is based on [wepoll v1.5.8](https://github.com/piscisaureus/wepoll/commit/0598a791bf9cbbf480793d778930fc635b044980).
4+
5+
An eventfd-like mechanism is added to it. After making the changes, we can wake up `trantor::EventLoop` from the epoll_wait() function.
6+
7+
## Modifications
8+
9+
```shell
10+
diff wepoll.h Wepoll.h
11+
53a54
12+
> EPOLLEVENT = (int)(1U << 14),
13+
67a69
14+
> #define EPOLLEVENT (1U << 14)
15+
111a114
16+
> WEPOLL_EXPORT void epoll_post_signal(HANDLE ephnd, uint64_t event);
17+
```
18+
19+
```shell
20+
diff wepoll.c Wepoll.c
21+
50a51
22+
> EPOLLEVENT = (int)(1U << 14),
23+
64a66
24+
> #define EPOLLEVENT (1U << 14)
25+
1262a1265,1271
26+
> if (iocp_events[i].lpCompletionKey)
27+
> {
28+
> struct epoll_event* ev = &epoll_events[epoll_event_count++];
29+
> ev->data.u64 = (uint64_t)iocp_events[i].lpCompletionKey;
30+
> ev->events = EPOLLEVENT;
31+
> continue;
32+
> }
33+
2441a2451,2457
34+
> void epoll_post_signal(HANDLE port_handle, uint64_t event)
35+
> {
36+
> ULONG_PTR ev;
37+
> ev = (ULONG_PTR)event;
38+
> PostQueuedCompletionStatus(port_handle, 1, ev, NULL);
39+
> }
40+
>
41+
```

0 commit comments

Comments
 (0)