Skip to content

Commit 16e66b0

Browse files
committed
HevTaskIOReactorWSA: Init.
1 parent f352f9f commit 16e66b0

8 files changed

+547
-22
lines changed

.github/workflows/build.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,9 @@ jobs:
152152
gcc
153153
git
154154
make
155-
mingw-w64-clang-x86_64-libkqueue
156155
- name: Build
157156
shell: msys2 {0}
158157
run: |
159158
export MSYS=winsymlinks:native
160159
git clone --depth=1 --recursive file://`pwd` work; cd work
161-
make CFLAGS="-I/clang64/include/kqueue" LFLAGS="-L/clang64/lib -lkqueue" -j`nproc`
160+
make LFLAGS="-lmsys-2.0 -lws2_32" -j`nproc`

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ cd hev-task-system
8080
export MSYS=winsymlinks:native
8181
git clone https://gitlab.com/hev/hev-task-system
8282
cd hev-task-system
83-
# depends on mingw-w64-clang-x86_64-libkqueue
84-
make CFLAGS="-I/clang64/include/kqueue" LFLAGS="-L/clang64/lib -lkqueue"
83+
make LFLAGS="-lmsys-2.0 -lws2_32"
8584
```
8685

8786
## Demos

src/kern/io/hev-task-io-reactor-kqueue.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
============================================================================
88
*/
99

10-
#if !defined(__linux__)
10+
#if !defined(__linux__) && !defined(__MSYS__)
1111

1212
#include <fcntl.h>
1313
#include <unistd.h>
@@ -55,20 +55,20 @@ hev_task_io_reactor_destroy (HevTaskIOReactor *self)
5555
}
5656

5757
int
58-
hev_task_io_reactor_setup (HevTaskIOReactor *reactor,
58+
hev_task_io_reactor_setup (HevTaskIOReactor *self,
5959
HevTaskIOReactorSetupEvent *events, int count)
6060
{
6161
int i, res = -1;
6262

6363
for (i = 0; i < count; i++) {
6464
if (!(events[i].flags & EV_DELETE)) {
65-
res = kevent (reactor->fd, &events[i], count - i, NULL, 0, NULL);
65+
res = kevent (self->fd, &events[i], count - i, NULL, 0, NULL);
6666
break;
6767
}
68-
res &= kevent (reactor->fd, &events[i], 1, NULL, 0, NULL);
68+
res &= kevent (self->fd, &events[i], 1, NULL, 0, NULL);
6969
}
7070

7171
return res;
7272
}
7373

74-
#endif /* !defined(__linux__) */
74+
#endif /* !defined(__linux__) && !defined(__MSYS__) */

src/kern/io/hev-task-io-reactor-kqueue.h

+3-11
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515
#include <sys/event.h>
1616
#include <sys/time.h>
1717

18-
#if defined(__MSYS__)
19-
#include <io.h>
20-
#endif
21-
22-
#ifndef get_osfhandle
23-
#define get_osfhandle
24-
#endif
25-
2618
#ifndef EVFILT_EXCEPT
2719
#define EVFILT_EXCEPT (0)
2820
#endif
@@ -47,7 +39,7 @@ enum _HevTaskIOReactorOperation
4739
};
4840

4941
static inline int
50-
hev_task_io_reactor_wait (HevTaskIOReactor *reactor,
42+
hev_task_io_reactor_wait (HevTaskIOReactor *self,
5143
HevTaskIOReactorWaitEvent *events, int count,
5244
int timeout)
5345
{
@@ -60,7 +52,7 @@ hev_task_io_reactor_wait (HevTaskIOReactor *reactor,
6052
tsp = &ts;
6153
}
6254

63-
return kevent (reactor->fd, NULL, 0, events, count, tsp);
55+
return kevent (self->fd, NULL, 0, events, count, tsp);
6456
}
6557

6658
static inline void
@@ -79,7 +71,7 @@ hev_task_io_reactor_setup_event_set (HevTaskIOReactorSetupEvent *event, int fd,
7971
action = EV_DELETE;
8072
}
8173

82-
EV_SET (event, get_osfhandle (fd), events, action | EV_CLEAR, 0, 0, data);
74+
EV_SET (event, fd, events, action | EV_CLEAR, 0, 0, data);
8375
}
8476

8577
static inline int

0 commit comments

Comments
 (0)