Commit f032d6ff authored by legoc's avatar legoc
Browse files

Renamed App cancelWaitFor() in cancel()

parent e27fcebd
...@@ -816,7 +816,7 @@ public: ...@@ -816,7 +816,7 @@ public:
/** /**
* Cancels the blocking waitFor() in another thread. * Cancels the blocking waitFor() in another thread.
*/ */
void cancelWaitFor(); void cancel();
/** /**
* Gets the last state. * Gets the last state.
......
...@@ -720,7 +720,7 @@ bool App::kill() { ...@@ -720,7 +720,7 @@ bool App::kill() {
State App::waitFor(int states, KeyValue& keyValue, bool blocking) { State App::waitFor(int states, KeyValue& keyValue, bool blocking) {
// Create a scoped waiting so that it is removed at the exit of the function. // Create a scoped waiting so that it is removed at the exit of the function.
Waiting scopedWaiting {std::bind(&App::cancelWaitFor, this)}; Waiting scopedWaiting {std::bind(&App::cancel, this)};
// Test the terminal state. // Test the terminal state.
if (m_lastState == SUCCESS if (m_lastState == SUCCESS
...@@ -814,8 +814,8 @@ State App::waitFor(KeyValue& keyValue) { ...@@ -814,8 +814,8 @@ State App::waitFor(KeyValue& keyValue) {
return waitFor(0, keyValue, true); return waitFor(0, keyValue, true);
} }
void App::cancelWaitFor() { void App::cancel() {
cancel(m_id); EventListener::cancel(m_id);
} }
State App::getLastState() { State App::getLastState() {
......
...@@ -757,7 +757,7 @@ public class App extends EventListener { ...@@ -757,7 +757,7 @@ public class App extends EventListener {
/** /**
* Cancels the blocking waitFor() in another thread. * Cancels the blocking waitFor() in another thread.
*/ */
public void cancelWaitFor() { public void cancel() {
cancel(id); cancel(id);
} }
......
...@@ -34,7 +34,7 @@ public class AppWaiting extends Waiting { ...@@ -34,7 +34,7 @@ public class AppWaiting extends Waiting {
@Override @Override
public void cancel() { public void cancel() {
instance.cancelWaitFor(); instance.cancel();
} }
@Override @Override
......
...@@ -137,7 +137,7 @@ PYBIND11_MODULE(cameopy, m) { ...@@ -137,7 +137,7 @@ PYBIND11_MODULE(cameopy, m) {
.def("waitFor", py::overload_cast<int>(&App::waitFor), .def("waitFor", py::overload_cast<int>(&App::waitFor),
"states"_a, "states"_a,
py::call_guard<py::gil_scoped_release>()) py::call_guard<py::gil_scoped_release>())
.def("cancelWaitFor", &App::cancelWaitFor, py::call_guard<py::gil_scoped_release>()) .def("cancel", &App::cancel, py::call_guard<py::gil_scoped_release>())
.def("getLastState", &App::getLastState, py::call_guard<py::gil_scoped_release>()) .def("getLastState", &App::getLastState, py::call_guard<py::gil_scoped_release>())
.def("getActualState", &App::getActualState, py::call_guard<py::gil_scoped_release>()) .def("getActualState", &App::getActualState, py::call_guard<py::gil_scoped_release>())
.def("getPastStates", &App::getPastStates, py::call_guard<py::gil_scoped_release>()) .def("getPastStates", &App::getPastStates, py::call_guard<py::gil_scoped_release>())
......
...@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) { ...@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
// Start thread. // Start thread.
thread cancelThread([&] { thread cancelThread([&] {
this_thread::sleep_for(chrono::seconds(1)); this_thread::sleep_for(chrono::seconds(1));
stopApplication->cancelWaitFor(); stopApplication->cancel();
}); });
State state = stopApplication->waitFor(); State state = stopApplication->waitFor();
......
...@@ -88,7 +88,7 @@ public class TestCancel { ...@@ -88,7 +88,7 @@ public class TestCancel {
public void run() { public void run() {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
stopApplication.cancelWaitFor(); stopApplication.cancel();
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
......
...@@ -9,7 +9,7 @@ def cancelAll(): ...@@ -9,7 +9,7 @@ def cancelAll():
def cancelWaitFor(instance): def cancelWaitFor(instance):
time.sleep(1) time.sleep(1)
instance.cancelWaitFor() instance.cancel()
def cancelWaitForSubscribers(publisher): def cancelWaitForSubscribers(publisher):
time.sleep(1) time.sleep(1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment