-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Related to #2565. See file:
https://github.com/giampaolo/psutil/blob/01111d78/psutil/arch/linux/users.c
In here we use setutent()
and endutent()
syscalls, which appear to be "global", and hence not thread safe.
I'm not sure how to properly handle this because I'm confused by the existence of the 2 thread models: the "normal" thread-model, for which we could use PyThread_acquire_lock
/ PyThread_release_lock
or Py_BEGIN_ALLOW_THREADS
/ Py_END_ALLOW_THREADS
(are they the same?). And now there is the "free-thread python mode" which looks like a different beast. E.g. also in free-thread-python I'd be tempted to use a lock, but it should be defined as a global, so I'm not sure if we'd incur in the same scenario described in #2565. Perhaps @colesbury has some advice?