Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement enif_select and add select and mkfifo to file functions #617

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

pguyot
Copy link
Collaborator

@pguyot pguyot commented Jun 4, 2023

enif_select is an API that allows nifs to use select(2) or equivalent,
paving the way for nif-based drivers.

enif_select depends on platform implementations and this PR only implements
it on generic_unix platform, using sys_poll_event select-like function,
namely kqueue(2) or poll(2). As a result, enif_select does not exactly
behaves like select(2) and this is documented.

For testing, add mkfifo and select to POSIX file functions.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@pguyot pguyot force-pushed the w22/add-enif_select branch 2 times, most recently from 1f79b5a to e7350d0 Compare June 6, 2023 19:39
@pguyot pguyot mentioned this pull request Jun 6, 2023
@pguyot pguyot force-pushed the w22/add-enif_select branch 2 times, most recently from cf9867d to d75c2f3 Compare July 3, 2023 06:32
@pguyot pguyot marked this pull request as ready for review July 3, 2023 06:38
@pguyot pguyot force-pushed the w22/add-enif_select branch 2 times, most recently from e285a0b to afb7f8d Compare July 3, 2023 18:34
@fadushin fadushin requested a review from bettio July 11, 2023 12:40
@pguyot pguyot force-pushed the w22/add-enif_select branch 4 times, most recently from 420a931 to dcf3301 Compare July 16, 2023 22:38
`enif_select` is an API that allows nifs to use `select(2)` or equivalent,
paving the way for nif-based drivers.

`enif_select` depends on platform implementations and this PR only implements
it on generic_unix platform, using `sys_poll_event` select-like function,
namely `kqueue(2)` or `poll(2)`. As a result, `enif_select` does not exactly
behaves like `select(2)` and this is documented.

For testing, add `mkfifo` and `select` to POSIX file functions.

Signed-off-by: Paul Guyot <pguyot@kallisys.net>
@bettio bettio merged commit ea8fa33 into atomvm:master Jul 21, 2023
83 checks passed
@pguyot pguyot deleted the w22/add-enif_select branch July 22, 2023 04:28
bettio added a commit that referenced this pull request Jul 28, 2023
Add enif_monitor

Continuation of PR #617

NIF monitors are required for enif_select-based drivers that do not leak, so
they can release resources when the target process dies.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants