Commit 4f17c6ab authored by legoc's avatar legoc

Reviewed cancelcpp test

parent c30f13bf
......@@ -69,19 +69,19 @@ int main(int argc, char *argv[]) {
// Start thread
unique_ptr<thread> cancelThread(new thread(&cancelAll));
//
// stopApplication->waitFor();
//
// cout << "end of waitFor" << endl;
//
// stopApplication->stop();
// application::State state = stopApplication->waitFor();
//
// cout << "end of stopcpp with state " << application::toString(state) << endl;
//
// cancelThread->join();
stopApplication->waitFor();
cout << "end of waitFor" << endl;
stopApplication->stop();
application::State state = stopApplication->waitFor();
cout << "end of stopcpp with state " << application::toString(state) << endl;
cancelThread->join();
}
/*
// Test the cancel function
{
cout << "starting stopcpp for cancelWaitFor" << endl;
......@@ -180,27 +180,37 @@ int main(int argc, char *argv[]) {
cancelThread->join();
killThread->join();
}
*/
// Test the cancelling of a requester
{
cout << "starting respcpp for testing cancel of a requester" << endl;
// // Use a shared_ptr to use it in the thread and the main thread.
// shared_ptr<application::Instance> responderApplication(server.start("respcpp"));
//
// // Create a requester
// unique_ptr<application::Requester> requester = application::Requester::create(*responderApplication, "responder");
//
// // Start thread
// unique_ptr<thread> cancelThread(new thread(&cancelAll));
//
// // Receiving data
//
// while (subscriber->receive(data)) {
// cout << "received " << data << endl;
// }
//
// cout << "subscriber end of stream " << subscriber->hasEnded() << endl;
// Use a shared_ptr to use it in the thread and the main thread.
shared_ptr<application::Instance> responderApplication(server.start("repcpp"));
cout << "started " << *responderApplication << endl;
// Start thread
unique_ptr<thread> cancelThread(new thread(&cancelAll));
cout << "create requester" << endl;
// Create a requester
try {
unique_ptr<application::Requester> requester = application::Requester::create(*responderApplication, "responder?");
}
catch (const cameo::RequesterCreationException&) {
cout << "cannot create requester" << endl;
}
cout << "end of creation of requester" << endl;
cancelThread->join();
responderApplication->kill();
responderApplication->waitFor();
cout << "end of responder" << endl;
}
}
......
......@@ -166,7 +166,7 @@ public class TestSelector {
apps.add("startpubcpp");
apps.add("startnpubcpp");
apps.add("startrepcpp");
//apps.add("cancelcpp");
apps.add("cancelcpp");
}
else {
apps.add(appName);
......
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