Skip to content

Commit

Permalink
Fix Python sim.wait() #385
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed Mar 9, 2023
1 parent d7e9288 commit 8a867d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/PySimulation.cpp
Expand Up @@ -565,7 +565,7 @@ namespace {
auto &task = self->s->task;

if (task.isSet()) {
task->join();
task->wait();
task.release();
}

Expand Down
7 changes: 7 additions & 0 deletions src/python/PyTask.cpp
Expand Up @@ -35,6 +35,13 @@ void PyTask::join() {
}


void PyTask::wait() {
Py_BEGIN_ALLOW_THREADS;
Thread::wait();
Py_END_ALLOW_THREADS;
}


void PyTask::setCallback(PyObject *cb) {
if (cb && cb != Py_None && !PyCallable_Check(cb))
THROW("`callback` object not callable");
Expand Down
1 change: 1 addition & 0 deletions src/python/PyTask.h
Expand Up @@ -37,6 +37,7 @@ class PyTask : public CAMotics::Task, public cb::Thread {

// From cb::Thread
void join();
void wait();

// From CAMotics::Task
void updated(const std::string &status, double progress);
Expand Down

0 comments on commit 8a867d3

Please sign in to comment.