This adds PyUnstable_Module_SetGIL calls to allow psutil to run with the GIL disabled in the CPython free-threading builds. This also fixes a few thread-safety that could cause problems with the GIL disabled:
The temporary argv C array is no longer global in OpenBSD's proc_cmdline
The maxcpus variable is no longer global in FreeBSD's per_cpu_times.
Summary
Description
This adds
PyUnstable_Module_SetGIL
calls to allowpsutil
to run with the GIL disabled in the CPython free-threading builds. This also fixes a few thread-safety that could cause problems with the GIL disabled:argv
C array is no longer global in OpenBSD'sproc_cmdline
maxcpus
variable is no longer global in FreeBSD'sper_cpu_times
.