On 3 Dec 2022, at 13:13, Weatherby,Gerard <[email protected]> wrote:
Signalfd and select could probably be made to work if one codes around
the race conditions pselect is provided to avoid. I’m not sure if using
the GIL (for CPython) is sufficient or if a dedicated concurrency
control (e.g. lock, mutex, semaphore) is necessary.
An alternative is to call the C library function via a wrapper. I had
need to use setfsuid on a project a couple of years ago and found this
example:
[1]https://gist.github.com/atdt/ebafa299e843a767139b
I read this on SO when researching your question.
Search for epoll and signal.
(I would post the link but ipad turns the link into an image…)
I assume that the lack of pepoll means you can use epoll and
signalfd without race conditions. The trick seems to be setting
the signal to ignore.
Barry
From: Python-list <[email protected]>
on behalf of Barry <[email protected]>
Date: Friday, December 2, 2022 at 7:02 PM
To: Ian Pilcher <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Calling pselect/ppoll/epoll_pwait
*** Attention: This is an external email. Use caution responding,
opening attachments or clicking on links. ***
> On 2 Dec 2022, at 20:03, Ian Pilcher <[email protected]> wrote:
>
> Does Python provide any way to call the "p" variants of the I/O
> multiplexing functions?
>
> Looking at the documentation of the select[1] and selectors[2]
modules,
> it appears that they expose only the "non-p" variants.
>
> [1]
[2]https://urldefense.com/v3/__https://docs.python.org/3/library/select.html__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_OD5qBjeA$
> [2]
[3]https://urldefense.com/v3/__https://docs.python.org/3/library/selectors.html__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_MwNjgO8A$
Can you use signalfd and select/poll/epoll?
Barry
>
> --
>
========================================================================
> Google Where SkyNet meets
Idiocracy
>
========================================================================
> --
>
[4]https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_PhasKBfg$
>
--
[5]https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_PhasKBfg$
References
Visible links
1. https://gist.github.com/atdt/ebafa299e843a767139b
2.
https://urldefense.com/v3/__https:/docs.python.org/3/library/select.html__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_OD5qBjeA$
3.
https://urldefense.com/v3/__https:/docs.python.org/3/library/selectors.html__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_MwNjgO8A$
4.
https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_PhasKBfg$
5.
https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!hClFFo4XdiwQAhHxDbHA5zFr490Of9uheHSf84V9cREMHyw1kX-baG5HzXWMt-hFLP30q6DpSUb2G_PhasKBfg$
--
https://mail.python.org/mailman/listinfo/python-list