Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ Removed
Porting to Python 3.10
======================

This section lists previously described changes and other bugfixes
that may require changes to your code.


* Add :func:`os.cpu_count()` support for VxWorks RTOS.
Comment thread
pxinwr marked this conversation as resolved.
Outdated

Build Changes
=============
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :func:`os.cpu_count()` support for VxWorks RTOS.
5 changes: 5 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
# include <windows.h>
#endif

#ifdef __VXWORKS__
#include "pycore_bitutils.h" // _Py_popcount32()
Comment thread
pxinwr marked this conversation as resolved.
Outdated
#endif
#include "pycore_ceval.h" // _PyEval_ReInitThreads()
#include "pycore_import.h" // _PyImport_ReInitLock()
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
Expand Down Expand Up @@ -12607,6 +12610,8 @@ os_cpu_count_impl(PyObject *module)
ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL);
#elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
ncpu = sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__VXWORKS__)
ncpu = _Py_popcount32(vxCpuEnabledGet());
#elif defined(__DragonFly__) || \
defined(__OpenBSD__) || \
defined(__FreeBSD__) || \
Expand Down