Calvin Rose
53aa19a916
Several changes to move pipe creation back into ev.c
2020-11-18 10:53:36 -06:00
Calvin Rose
cff52ded58
Add JANET_ASYNC_EVENT_CANCEL
...
also fix bug that could cause event loop to hang.
2020-11-16 18:46:59 -06:00
Calvin Rose
078f50d45a
When reading from a stream, EPIPE is considered EOS.
...
Before, EPIPE caused an error, but in most cases it is better
to consider it an end of stream. In the future, we may want to allow
cusomtization of this behavior with flags on the stream but for now
let's keep it simpler.
2020-11-16 16:49:27 -06:00
Calvin Rose
9ec5689d6b
Don't use gcroot/unroot for tracking IO operations.
...
This could have bad effects in higher load situations, and
duplicates code. It is better to keep a dedicated list of
scheduled IO operations which can be efficiently added and
removed from. It also provides and easy way to enumerate
scheduled IO operations.
2020-11-16 09:30:04 -06:00
Calvin Rose
a25b030e36
Fix EPOLL implementation.
2020-11-15 19:40:47 -06:00
Calvin Rose
d7af4596e1
Move math.h include out of windows ifdef
2020-11-15 10:21:37 -06:00
Calvin Rose
a7ed3dea4b
Remove some flags in os/open.
2020-11-15 10:06:20 -06:00
Calvin Rose
cdcb774dc8
Add os/pipe and os/open.
...
ev/pipe -> os/pipe, and os/open is a wrapper
around the open system call.
2020-11-15 09:57:29 -06:00
Calvin Rose
d199c817dc
Broken Pipe error on windows should just be end of stream.
2020-11-14 16:03:51 -06:00
Calvin Rose
139e3fab25
Invert status check for (Read/Write)File
2020-11-14 15:52:01 -06:00
Calvin Rose
7a98f9aa02
Improve windows error messages on write failures.
2020-11-14 15:48:21 -06:00
Calvin Rose
b53dd67e74
Use custom pipe implementation for overlapped io.
2020-11-14 15:44:19 -06:00
Calvin Rose
d50c4ef6da
Try again for windows build.
2020-11-14 15:01:52 -06:00
Calvin Rose
7d0b1955a2
typo
2020-11-14 14:55:26 -06:00
Calvin Rose
16cf7681f0
Fix some windows issues.
2020-11-14 14:40:39 -06:00
Calvin Rose
12f09ad2d7
Add ev/pipe and move stream code into ev.c
...
Also adds a lot to the C API and changes things up.
2020-11-14 14:29:11 -06:00
Calvin Rose
b3e88a8d80
Move read/write functions into ev.c from net.c
...
This code can also be used for non-network streams.
2020-11-14 11:48:23 -06:00
Calvin Rose
caa6576719
Fix formatting.
2020-11-11 15:35:44 -06:00
Calvin Rose
56b1ea3726
Include math.h to fix some bugs on 32 bit windows.
2020-11-08 19:06:35 -06:00
Calvin Rose
d6391f2d70
Get windows IOCP working for accept.
...
This also changes the api of servers slightly -
in light of having support for ev tasks, it is probably better
to remove the "simple" server code and replace it with some Janet
or remove it all together. While convenient, it has issues with error
handling and rigidity.
2020-11-08 18:56:13 -06:00
Calvin Rose
07910272e2
Get socket reads and writes working with IOCP.
2020-11-08 10:38:28 -06:00
Calvin Rose
8942e348bd
Small change to windows ev.
2020-11-02 08:27:45 -06:00
Calvin Rose
9f27336827
Update windows ev code.
2020-11-02 08:19:53 -06:00
Calvin Rose
88c1cf3ee7
Reformat files.
2020-10-11 09:33:07 -05:00
Calvin Rose
813e3fdcfd
Merge branch 'windows-ev' into ev
2020-10-11 09:32:17 -05:00
Calvin Rose
cb4903fa86
Overhaul of poll loop, redo ev/select.
2020-10-11 09:14:14 -05:00
Calvin Rose
964a800d51
More work on windows event loop code.
2020-10-06 19:07:29 -05:00
Calvin Rose
2e944931b3
Update timestamp function to work on windows.
2020-10-04 15:18:31 -05:00
Calvin Rose
db67538311
Work on getting ev support on windows.
2020-10-04 12:46:15 -05:00
Calvin Rose
191d0001f4
Add header on BSDs.
2020-09-07 15:22:18 -05:00
Calvin Rose
1a04ce33f1
Conditionally include epoll headers.
2020-09-07 13:13:28 -05:00
Calvin Rose
babfe50550
Merge branch 'master' into ev
...
Also add poll implementation for ev.
2020-09-07 12:52:50 -05:00
Calvin Rose
86e00e865e
Merge branch 'master' into ev
2020-08-23 11:25:04 -05:00
Calvin Rose
30522bbf7d
Merge branch 'master' into ev
2020-08-16 17:52:36 -05:00
Calvin Rose
fb26c9b2c4
Add ev/select and ev/rselect initial implementation.
...
Getting closer to a CSP implmententation. Probably
useful to move scheduling fields outside of fibers
and into an external table.
2020-08-09 00:20:27 -05:00
Calvin Rose
78ffb63429
Disallow mutlitple state machines waiting for a single fiber.
...
A 'select' operator will be channel based, not state machine based.
2020-08-08 07:51:46 -05:00
Calvin Rose
cb898fabf4
Set default channel size to 0.
2020-08-03 07:57:02 -05:00
Calvin Rose
742c5bb639
Use a common queue implementation.
...
Queues occur in three places, so we use a single
implementation rather than three separate ones. This also
has the result that janet_vm_spawn will not overflow in the case
of channel-heavy, IO-light operation.
2020-08-01 14:20:58 -05:00
Calvin Rose
297de01d95
Add preliminary channel implementation.
2020-08-01 13:13:58 -05:00
Calvin Rose
2eb2dddb59
Begin work on channels.
2020-07-26 23:45:25 -05:00
Calvin Rose
553b4d9428
Add timeouts to net functions.
...
Further debugging of the general timeout system, as well
as having a single fiber wait on multiple state machines (select).
2020-07-19 19:41:12 -05:00
Calvin Rose
cd197e8be3
Add ev/call.
...
This is a common operation, and making fibers manually can be tedious.
2020-07-06 19:13:32 -05:00
Calvin Rose
9ba94d2c6b
More work on timeouts and racing listeners.
...
When two listeners are racing to resume the same fiber, the
first should cancel out the other.
2020-07-05 17:26:17 -05:00
Calvin Rose
ec0d0ba368
Initial UDP implementation.
2020-06-02 19:47:50 -05:00
Calvin Rose
a78af0a7fb
Do not explicitly free state machines, instead return a status.
...
This makes it harder to have some kind of use after free issue.
2020-05-30 11:31:05 -05:00
Calvin Rose
117ae196fd
Add net/flush.
...
Useful for simple TCP protocols (netrepl), which benefit from being able
to immediately send a message.
2020-05-28 19:22:38 -05:00
Calvin Rose
4c211c8dce
More updates to the ev library.
2020-05-28 16:51:11 -05:00
Calvin Rose
b68b0a256e
Start with ev module.
2020-05-28 10:39:40 -05:00