diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-08-02 22:41:34 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-08-02 22:41:34 (GMT) |
commit | 2740af8cc48b0f310557c0630d613301b7a5c2d4 (patch) | |
tree | e0e43ab66e547579f31fd01f221bf011eb909943 /Modules | |
parent | 94b580d423524188bcf7136f9829fb68eb6d15d3 (diff) | |
download | cpython-2740af8cc48b0f310557c0630d613301b7a5c2d4.zip cpython-2740af8cc48b0f310557c0630d613301b7a5c2d4.tar.gz cpython-2740af8cc48b0f310557c0630d613301b7a5c2d4.tar.bz2 |
sched.h can exist without sched affinity support
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index ef8f82e..bb13f47 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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) |