aboutsummaryrefslogtreecommitdiff
path: root/src/3rdParty/efsw/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdParty/efsw/platform')
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/platformimpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/FileSystemImpl.cpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/FileSystemImpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/MutexImpl.cpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/MutexImpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/SystemImpl.cpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/SystemImpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/ThreadImpl.cpp17
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/posix/ThreadImpl.hpp7
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/FileSystemImpl.cpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/FileSystemImpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/MutexImpl.cpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/MutexImpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/SystemImpl.cpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/SystemImpl.hpp0
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/ThreadImpl.cpp2
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/platform/win/ThreadImpl.hpp2
17 files changed, 16 insertions, 12 deletions
diff --git a/src/3rdParty/efsw/platform/platformimpl.hpp b/src/3rdParty/efsw/platform/platformimpl.hpp
index 5442580..5442580 100755..100644
--- a/src/3rdParty/efsw/platform/platformimpl.hpp
+++ b/src/3rdParty/efsw/platform/platformimpl.hpp
diff --git a/src/3rdParty/efsw/platform/posix/FileSystemImpl.cpp b/src/3rdParty/efsw/platform/posix/FileSystemImpl.cpp
index 92eeb47..92eeb47 100755..100644
--- a/src/3rdParty/efsw/platform/posix/FileSystemImpl.cpp
+++ b/src/3rdParty/efsw/platform/posix/FileSystemImpl.cpp
diff --git a/src/3rdParty/efsw/platform/posix/FileSystemImpl.hpp b/src/3rdParty/efsw/platform/posix/FileSystemImpl.hpp
index 0bfba76..0bfba76 100755..100644
--- a/src/3rdParty/efsw/platform/posix/FileSystemImpl.hpp
+++ b/src/3rdParty/efsw/platform/posix/FileSystemImpl.hpp
diff --git a/src/3rdParty/efsw/platform/posix/MutexImpl.cpp b/src/3rdParty/efsw/platform/posix/MutexImpl.cpp
index 2233798..2233798 100755..100644
--- a/src/3rdParty/efsw/platform/posix/MutexImpl.cpp
+++ b/src/3rdParty/efsw/platform/posix/MutexImpl.cpp
diff --git a/src/3rdParty/efsw/platform/posix/MutexImpl.hpp b/src/3rdParty/efsw/platform/posix/MutexImpl.hpp
index a33d827..a33d827 100755..100644
--- a/src/3rdParty/efsw/platform/posix/MutexImpl.hpp
+++ b/src/3rdParty/efsw/platform/posix/MutexImpl.hpp
diff --git a/src/3rdParty/efsw/platform/posix/SystemImpl.cpp b/src/3rdParty/efsw/platform/posix/SystemImpl.cpp
index 37d4120..37d4120 100755..100644
--- a/src/3rdParty/efsw/platform/posix/SystemImpl.cpp
+++ b/src/3rdParty/efsw/platform/posix/SystemImpl.cpp
diff --git a/src/3rdParty/efsw/platform/posix/SystemImpl.hpp b/src/3rdParty/efsw/platform/posix/SystemImpl.hpp
index 9322b06..9322b06 100755..100644
--- a/src/3rdParty/efsw/platform/posix/SystemImpl.hpp
+++ b/src/3rdParty/efsw/platform/posix/SystemImpl.hpp
diff --git a/src/3rdParty/efsw/platform/posix/ThreadImpl.cpp b/src/3rdParty/efsw/platform/posix/ThreadImpl.cpp
index e0ae84f..772fbc9 100755..100644
--- a/src/3rdParty/efsw/platform/posix/ThreadImpl.cpp
+++ b/src/3rdParty/efsw/platform/posix/ThreadImpl.cpp
@@ -5,11 +5,10 @@
5 5
6#include <cassert> 6#include <cassert>
7#include <efsw/Debug.hpp> 7#include <efsw/Debug.hpp>
8#include <iostream>
9 8
10namespace efsw { namespace Platform { 9namespace efsw { namespace Platform {
11 10
12ThreadImpl::ThreadImpl( Thread* owner ) : mIsActive( false ) { 11ThreadImpl::ThreadImpl( efsw::Thread* owner ) : mIsActive( false ) {
13 mIsActive = pthread_create( &mThread, NULL, &ThreadImpl::entryPoint, owner ) == 0; 12 mIsActive = pthread_create( &mThread, NULL, &ThreadImpl::entryPoint, owner ) == 0;
14 13
15 if ( !mIsActive ) { 14 if ( !mIsActive ) {
@@ -17,14 +16,16 @@ ThreadImpl::ThreadImpl( Thread* owner ) : mIsActive( false ) {
17 } 16 }
18} 17}
19 18
19ThreadImpl::~ThreadImpl() {
20 terminate();
21}
22
20void ThreadImpl::wait() { 23void ThreadImpl::wait() {
21 // Wait for the thread to finish, no timeout 24 // Wait for the thread to finish, no timeout
22 if ( mIsActive ) { 25 if ( mIsActive ) {
23 assert( pthread_equal( pthread_self(), mThread ) == 0 ); 26 assert( pthread_equal( pthread_self(), mThread ) == 0 );
24 27
25 pthread_join( mThread, NULL ); 28 mIsActive = pthread_join( mThread, NULL ) != 0;
26
27 mIsActive = false; // Reset the thread state
28 } 29 }
29} 30}
30 31
@@ -41,14 +42,14 @@ void ThreadImpl::terminate() {
41} 42}
42 43
43void* ThreadImpl::entryPoint( void* userData ) { 44void* ThreadImpl::entryPoint( void* userData ) {
44 // The Thread instance is stored in the user data
45 Thread* owner = static_cast<Thread*>( userData );
46
47// Tell the thread to handle cancel requests immediatly 45// Tell the thread to handle cancel requests immediatly
48#ifdef PTHREAD_CANCEL_ASYNCHRONOUS 46#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
49 pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL ); 47 pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL );
50#endif 48#endif
51 49
50 // The Thread instance is stored in the user data
51 Thread* owner = static_cast<Thread*>( userData );
52
52 // Forward to the owner 53 // Forward to the owner
53 owner->run(); 54 owner->run();
54 55
diff --git a/src/3rdParty/efsw/platform/posix/ThreadImpl.hpp b/src/3rdParty/efsw/platform/posix/ThreadImpl.hpp
index ffc6da0..2e02f9a 100755..100644
--- a/src/3rdParty/efsw/platform/posix/ThreadImpl.hpp
+++ b/src/3rdParty/efsw/platform/posix/ThreadImpl.hpp
@@ -5,6 +5,7 @@
5 5
6#if defined( EFSW_PLATFORM_POSIX ) 6#if defined( EFSW_PLATFORM_POSIX )
7 7
8#include <efsw/Atomic.hpp>
8#include <pthread.h> 9#include <pthread.h>
9 10
10namespace efsw { 11namespace efsw {
@@ -15,7 +16,9 @@ namespace Platform {
15 16
16class ThreadImpl { 17class ThreadImpl {
17 public: 18 public:
18 ThreadImpl( Thread* owner ); 19 explicit ThreadImpl( efsw::Thread* owner );
20
21 ~ThreadImpl();
19 22
20 void wait(); 23 void wait();
21 24
@@ -25,7 +28,7 @@ class ThreadImpl {
25 static void* entryPoint( void* userData ); 28 static void* entryPoint( void* userData );
26 29
27 pthread_t mThread; 30 pthread_t mThread;
28 bool mIsActive; 31 Atomic<bool> mIsActive;
29}; 32};
30 33
31} // namespace Platform 34} // namespace Platform
diff --git a/src/3rdParty/efsw/platform/win/FileSystemImpl.cpp b/src/3rdParty/efsw/platform/win/FileSystemImpl.cpp
index 2b87513..2b87513 100755..100644
--- a/src/3rdParty/efsw/platform/win/FileSystemImpl.cpp
+++ b/src/3rdParty/efsw/platform/win/FileSystemImpl.cpp
diff --git a/src/3rdParty/efsw/platform/win/FileSystemImpl.hpp b/src/3rdParty/efsw/platform/win/FileSystemImpl.hpp
index e952efc..e952efc 100755..100644
--- a/src/3rdParty/efsw/platform/win/FileSystemImpl.hpp
+++ b/src/3rdParty/efsw/platform/win/FileSystemImpl.hpp
diff --git a/src/3rdParty/efsw/platform/win/MutexImpl.cpp b/src/3rdParty/efsw/platform/win/MutexImpl.cpp
index 62b7f83..62b7f83 100755..100644
--- a/src/3rdParty/efsw/platform/win/MutexImpl.cpp
+++ b/src/3rdParty/efsw/platform/win/MutexImpl.cpp
diff --git a/src/3rdParty/efsw/platform/win/MutexImpl.hpp b/src/3rdParty/efsw/platform/win/MutexImpl.hpp
index 7b06492..7b06492 100755..100644
--- a/src/3rdParty/efsw/platform/win/MutexImpl.hpp
+++ b/src/3rdParty/efsw/platform/win/MutexImpl.hpp
diff --git a/src/3rdParty/efsw/platform/win/SystemImpl.cpp b/src/3rdParty/efsw/platform/win/SystemImpl.cpp
index d1f2b21..d1f2b21 100755..100644
--- a/src/3rdParty/efsw/platform/win/SystemImpl.cpp
+++ b/src/3rdParty/efsw/platform/win/SystemImpl.cpp
diff --git a/src/3rdParty/efsw/platform/win/SystemImpl.hpp b/src/3rdParty/efsw/platform/win/SystemImpl.hpp
index 99b4867..99b4867 100755..100644
--- a/src/3rdParty/efsw/platform/win/SystemImpl.hpp
+++ b/src/3rdParty/efsw/platform/win/SystemImpl.hpp
diff --git a/src/3rdParty/efsw/platform/win/ThreadImpl.cpp b/src/3rdParty/efsw/platform/win/ThreadImpl.cpp
index d0fde8b..463934c 100755..100644
--- a/src/3rdParty/efsw/platform/win/ThreadImpl.cpp
+++ b/src/3rdParty/efsw/platform/win/ThreadImpl.cpp
@@ -8,7 +8,7 @@
8 8
9namespace efsw { namespace Platform { 9namespace efsw { namespace Platform {
10 10
11ThreadImpl::ThreadImpl( Thread* owner ) { 11ThreadImpl::ThreadImpl( efsw::Thread* owner ) {
12 mThread = reinterpret_cast<HANDLE>( 12 mThread = reinterpret_cast<HANDLE>(
13 _beginthreadex( NULL, 0, &ThreadImpl::entryPoint, owner, 0, &mThreadId ) ); 13 _beginthreadex( NULL, 0, &ThreadImpl::entryPoint, owner, 0, &mThreadId ) );
14 14
diff --git a/src/3rdParty/efsw/platform/win/ThreadImpl.hpp b/src/3rdParty/efsw/platform/win/ThreadImpl.hpp
index 1afb593..455f24c 100755..100644
--- a/src/3rdParty/efsw/platform/win/ThreadImpl.hpp
+++ b/src/3rdParty/efsw/platform/win/ThreadImpl.hpp
@@ -19,7 +19,7 @@ namespace Platform {
19 19
20class ThreadImpl { 20class ThreadImpl {
21 public: 21 public:
22 ThreadImpl( Thread* owner ); 22 explicit ThreadImpl( efsw::Thread* owner );
23 23
24 ~ThreadImpl(); 24 ~ThreadImpl();
25 25