1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-12 03:28:07 +00:00

Address #1431 - level-trigger mode for net/accept-loop

In the edge-trigger mode before this change, if a socket
receives 2 connections before one can be handled, then only a single
connection is handle and 1 connection will never be handled in some
cases. Reverting to level-trigger mode makes this impossible.
This commit is contained in:
Calvin Rose
2024-04-26 19:28:20 -05:00
parent 7c9157a0ed
commit f0f1b7ce9e
3 changed files with 50 additions and 6 deletions

View File

@@ -636,6 +636,12 @@ JANET_API void janet_async_end(JanetFiber *fiber);
/* Needed for windows to mark a fiber as waiting for an IOCP completion event. Noop on other platforms. */
JANET_API void janet_async_in_flight(JanetFiber *fiber);
/* On some platforms, it is important to be able to control if a stream is edge-trigger or level triggered.
* For example, a server that is accepting connections might want to be level triggered or edge-triggered
* depending on expected service. */
JANET_API void janet_stream_edge_triggered(JanetStream *stream);
JANET_API void janet_stream_level_triggered(JanetStream *stream);
#endif
/* Janet uses atomic integers in several places for synchronization between threads and