Sha256: 23e6e80d46ea10bbeddd8d05c0b2c660138c1211e28e7b816315d941fd4746f7
Contents?: true
Size: 718 Bytes
Versions: 66
Compression:
Stored size: 718 Bytes
Contents
#include "../tut/tut.h" #include <boost/bind.hpp> #include <oxt/thread.hpp> #include <oxt/system_calls.hpp> #include <unistd.h> #include <ctime> using namespace oxt; using namespace std; using namespace boost; namespace tut { struct syscall_interruption_test { }; DEFINE_TEST_GROUP(syscall_interruption_test); struct SleepFunction { void operator()() { syscalls::usleep(6000000); } }; TEST_METHOD(1) { // System call interruption works. SleepFunction s; oxt::thread thr(s); usleep(20000); time_t begin, end, time_spent_in_thread; begin = time(NULL); thr.interrupt_and_join(); end = time(NULL); time_spent_in_thread = end - begin; ensure(time_spent_in_thread <= 2); } }
Version data entries
66 entries across 66 versions & 1 rubygems