diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-09-08 23:26:39 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-09-08 23:26:39 (GMT) |
commit | aa6c3a1257a29cc5bcf8b94893732ee553f27582 (patch) | |
tree | 625adb1a353a17ffed2c7e0bac686d705aaec93f /test/src/test-eventdelay.cpp | |
download | uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.zip uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.gz uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.bz2 |
Initial upload
Still somewhat quirky to build but fairly feature complete
Diffstat (limited to 'test/src/test-eventdelay.cpp')
-rw-r--r-- | test/src/test-eventdelay.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/src/test-eventdelay.cpp b/test/src/test-eventdelay.cpp new file mode 100644 index 0000000..6a28e44 --- /dev/null +++ b/test/src/test-eventdelay.cpp @@ -0,0 +1,39 @@ +#include "uscxml/concurrency/eventqueue/libevent/DelayedEventQueue.h" + +int eventCalled = 0; + +#include <sstream> + +static void callback(void* userData, const std::string eventId) { +// std::cout << eventId << ": " << (const char*)userData << std::endl; + std::cout << eventId << std::endl << std::flush; + eventCalled++; +} + +int main(int argc, char** argv) { + + using namespace uscxml; + DelayedEventQueue* eq = new DelayedEventQueue(); + + std::cout << "Starting" << std::endl; + eq->start(); + tthread::this_thread::sleep_for(tthread::chrono::milliseconds(10)); + +// eq->addEvent("foo", callback, 200, (void*)"event foo"); +// eq->addEvent("bar", callback, 400, (void*)"event bar"); +// eq->addEvent("bar", callback, 600, (void*)"event bar"); +// eq->cancelEvent("bar"); +// eq->addEvent("bar", callback, 300, (void*)"event bar"); +// eq->addEvent("baz", callback, 400, (void*)"event baz"); + + for (unsigned int i = 0; i <= 5000; i += 500) { +// eq->stop(); + std::stringstream ss; + ss << i; + eq->addEvent(ss.str(), callback, i, NULL); + std::cout << "Added " << i << std::endl; +// eq->start(); + } + tthread::this_thread::sleep_for(tthread::chrono::milliseconds(20000)); + +}
\ No newline at end of file |