From 421c8db14430011d40f8f8499ca4aefbcc26d07e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 9 Feb 2012 14:24:19 -0800 Subject: rt: Move rust_thread to its own files --- src/rt/sync/sync.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'src/rt/sync/sync.cpp') diff --git a/src/rt/sync/sync.cpp b/src/rt/sync/sync.cpp index 31162d35b03..3bf37986161 100644 --- a/src/rt/sync/sync.cpp +++ b/src/rt/sync/sync.cpp @@ -18,44 +18,3 @@ void sync::sleep(size_t timeout_in_ms) { usleep(timeout_in_ms * 1000); #endif } - -rust_thread::rust_thread() : thread(0) { -} - -#if defined(__WIN32__) -static DWORD WINAPI -#elif defined(__GNUC__) -static void * -#else -#error "Platform not supported" -#endif -rust_thread_start(void *ptr) { - rust_thread *thread = (rust_thread *) ptr; - thread->run(); - return 0; -} - -void -rust_thread::start() { -#if defined(__WIN32__) - thread = CreateThread(NULL, 0, rust_thread_start, this, 0, NULL); -#else - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, 1024 * 1024); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_create(&thread, &attr, rust_thread_start, (void *) this); -#endif -} - -void -rust_thread::join() { -#if defined(__WIN32__) - if (thread) - WaitForSingleObject(thread, INFINITE); -#else - if (thread) - pthread_join(thread, NULL); -#endif - thread = 0; -} -- cgit 1.4.1-3-g733a5