From a77b9081d4e17bfe8b887073c09d531b2f4c4842 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 24 Jun 2014 12:54:05 +0200 Subject: Move and rename class ThreadData to ThreadEngine::ThreadState --- include/threadengine.h | 4 +--- include/threadengines/threadengine_pthread.h | 13 +++++++------ include/threadengines/threadengine_win32.h | 13 +++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/threadengine.h b/include/threadengine.h index 032da1539..1b4ee1541 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -26,8 +26,6 @@ #include "config.h" #include "base.h" -class ThreadData; - /** Derive from this class to implement your own threaded sections of * code. Be sure to keep your code thread-safe and not prone to deadlocks * and race conditions if you MUST use threading! @@ -41,7 +39,7 @@ class CoreExport Thread /** Opaque thread state managed by the ThreadEngine */ - ThreadData state; + ThreadEngine::ThreadState state; /** ThreadEngine manages Thread::state */ diff --git a/include/threadengines/threadengine_pthread.h b/include/threadengines/threadengine_pthread.h index 9304536f1..454e3ea4a 100644 --- a/include/threadengines/threadengine_pthread.h +++ b/include/threadengines/threadengine_pthread.h @@ -36,6 +36,13 @@ class CoreExport ThreadEngine { public: + /** Per-thread state, present in each Thread object, managed by the ThreadEngine + */ + struct ThreadState + { + pthread_t pthread_id; + }; + /** Create a new thread. This takes an already allocated * Thread* pointer and initializes it to use this threading * engine. On failure, this function may throw a CoreException. @@ -57,12 +64,6 @@ class CoreExport ThreadEngine void Stop(Thread* thread); }; -class CoreExport ThreadData -{ - public: - pthread_t pthread_id; -}; - /** The Mutex class represents a mutex, which can be used to keep threads * properly synchronised. Use mutexes sparingly, as they are a good source * of thread deadlocks etc, and should be avoided except where absolutely diff --git a/include/threadengines/threadengine_win32.h b/include/threadengines/threadengine_win32.h index 1cebb50fe..bf8658853 100644 --- a/include/threadengines/threadengine_win32.h +++ b/include/threadengines/threadengine_win32.h @@ -38,6 +38,13 @@ class Thread; class CoreExport ThreadEngine { public: + /** Per-thread state, present in each Thread object, managed by the ThreadEngine + */ + struct ThreadState + { + HANDLE handle; + }; + static DWORD WINAPI Entry(void* parameter); /** Create a new thread. This takes an already allocated @@ -61,12 +68,6 @@ class CoreExport ThreadEngine void Stop(Thread* thread); }; -class CoreExport ThreadData -{ - public: - HANDLE handle; -}; - /** The Mutex class represents a mutex, which can be used to keep threads * properly synchronised. Use mutexes sparingly, as they are a good source * of thread deadlocks etc, and should be avoided except where absolutely -- cgit v1.2.3