mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
sched.h can exist without sched affinity support
This commit is contained in:
parent
94b580d423
commit
2740af8cc4
5 changed files with 19 additions and 4 deletions
|
|
@ -4753,6 +4753,8 @@ posix_sched_yield(PyObject *self, PyObject *noargs)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SCHED_SETAFFINITY
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD;
|
||||
Py_ssize_t size;
|
||||
|
|
@ -5083,6 +5085,8 @@ posix_sched_getaffinity(PyObject *self, PyObject *args)
|
|||
return (PyObject *)res;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SCHED_SETAFFINITY */
|
||||
|
||||
#endif /* HAVE_SCHED_H */
|
||||
|
||||
/* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */
|
||||
|
|
@ -10056,9 +10060,11 @@ static PyMethodDef posix_methods[] = {
|
|||
{"sched_setparam", posix_sched_setparam, METH_VARARGS, posix_sched_setparam__doc__},
|
||||
{"sched_setscheduler", posix_sched_setscheduler, METH_VARARGS, posix_sched_setscheduler__doc__},
|
||||
{"sched_yield", posix_sched_yield, METH_NOARGS, posix_sched_yield__doc__},
|
||||
#ifdef HAVE_SCHED_SETAFFINITY
|
||||
{"sched_setaffinity", posix_sched_setaffinity, METH_VARARGS, posix_sched_setaffinity__doc__},
|
||||
{"sched_getaffinity", posix_sched_getaffinity, METH_VARARGS, posix_sched_getaffinity__doc__},
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX)
|
||||
{"openpty", posix_openpty, METH_NOARGS, posix_openpty__doc__},
|
||||
#endif /* HAVE_OPENPTY || HAVE__GETPTY || HAVE_DEV_PTMX */
|
||||
|
|
@ -10876,10 +10882,12 @@ INITFUNC(void)
|
|||
Py_INCREF(PyExc_OSError);
|
||||
PyModule_AddObject(m, "error", PyExc_OSError);
|
||||
|
||||
#ifdef HAVE_SCHED_SETAFFINITY
|
||||
if (PyType_Ready(&cpu_set_type) < 0)
|
||||
return NULL;
|
||||
Py_INCREF(&cpu_set_type);
|
||||
PyModule_AddObject(m, "cpu_set", (PyObject *)&cpu_set_type);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PUTENV
|
||||
if (posix_putenv_garbage == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue