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

Version Path
passenger-4.0.60 test/oxt/syscall_interruption_test.cpp
passenger-5.0.4 test/oxt/syscall_interruption_test.cpp
passenger-5.0.3 test/oxt/syscall_interruption_test.cpp
passenger-5.0.2 test/oxt/syscall_interruption_test.cpp
passenger-5.0.1 test/oxt/syscall_interruption_test.cpp
passenger-5.0.0.rc2 test/oxt/syscall_interruption_test.cpp
passenger-5.0.0.rc1 test/oxt/syscall_interruption_test.cpp
passenger-4.0.59 test/oxt/syscall_interruption_test.cpp
passenger-5.0.0.beta3 test/oxt/syscall_interruption_test.cpp
passenger-4.0.58 test/oxt/syscall_interruption_test.cpp
passenger-4.0.57 test/oxt/syscall_interruption_test.cpp
passenger-5.0.0.beta2 test/oxt/syscall_interruption_test.cpp
passenger-4.0.56 test/oxt/syscall_interruption_test.cpp
passenger-4.0.55 test/oxt/syscall_interruption_test.cpp
passenger-5.0.0.beta1 test/oxt/syscall_interruption_test.cpp
passenger-4.0.53 test/oxt/syscall_interruption_test.cpp
passenger-4.0.52 test/oxt/syscall_interruption_test.cpp
passenger-4.0.51 test/oxt/syscall_interruption_test.cpp
passenger-4.0.50 test/oxt/syscall_interruption_test.cpp
passenger-4.0.49 test/oxt/syscall_interruption_test.cpp