libpython: a few more opportunities for releasing the GIL

metadata
Wenzel Jakob 2014-10-12 14:11:03 +02:00
parent b13e41f8f9
commit 0cb3e6d4c8
1 changed files with 11 additions and 2 deletions

View File

@ -197,6 +197,16 @@ struct TSpectrum_to_Spectrum {
} }
}; };
static void scheduler_cancel(Scheduler *scheduler, ParallelProcess *proc) {
ReleaseGIL gil;
scheduler->cancel(proc);
}
static void scheduler_wait(Scheduler *scheduler, const ParallelProcess *proc) {
ReleaseGIL gil;
scheduler->wait(proc);
}
static Matrix4x4 *Matrix4x4_fromList(bp::list list) { static Matrix4x4 *Matrix4x4_fromList(bp::list list) {
if (bp::len(list) == 4) { if (bp::len(list) == 4) {
Float buf[4][4]; Float buf[4][4];
@ -1769,10 +1779,9 @@ void export_core() {
bp::class_<SerializableObjectVector>("SerializableObjectVector") bp::class_<SerializableObjectVector>("SerializableObjectVector")
.def(bp::vector_indexing_suite<SerializableObjectVector>()); .def(bp::vector_indexing_suite<SerializableObjectVector>());
bool (Scheduler::*scheduler_cancel)(ParallelProcess *)= &Scheduler::cancel;
BP_CLASS(Scheduler, Object, bp::no_init) BP_CLASS(Scheduler, Object, bp::no_init)
.def("schedule", &Scheduler::schedule) .def("schedule", &Scheduler::schedule)
.def("wait", &Scheduler::wait) .def("wait", scheduler_wait)
.def("cancel", scheduler_cancel) .def("cancel", scheduler_cancel)
.def("registerResource", &Scheduler::registerResource) .def("registerResource", &Scheduler::registerResource)
.def("registerMultiResource", &Scheduler::registerMultiResource) .def("registerMultiResource", &Scheduler::registerMultiResource)