Add some changes to make ETL more suitable for Fedora:
[synfig.git] / ETL / trunk / ETL / _thread.h
index 6939ee3..cb64933 100644 (file)
@@ -1,7 +1,7 @@
 /*! ========================================================================
 ** Extended Template and Library
 ** Thread Abstraction Class Implementation
-** $Id: _thread.h,v 1.1.1.1 2005/01/04 01:31:48 darco Exp $
+** $Id$
 **
 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
 **
 
 #define __USE_GNU
 
-#ifdef HAVE_PTHREAD_H
+#ifdef __ETL_HAS_PTHREAD_H
 # include <pthread.h>
 #endif
 
-#ifdef HAVE_SCHED_H
+#ifdef __ETL_HAS_SCHED_H
 # include <sched.h>
 #endif
 
-#ifdef HAVE_CREATETHREAD
+#ifdef __ETL_HAS_CREATETHREAD
 # include <windows.h>
 #endif
 
 /* === M A C R O S ========================================================= */
 
-#if ( defined (HAVE_PTHREAD_CREATE) || defined (HAVE_CLONE) || defined (HAVE_CREATETHREAD) ) && !defined (NO_THREADS)
+#if ( defined (__ETL_HAS_PTHREAD_CREATE) || defined (__ETL_HAS_CLONE) || defined (__ETL_HAS_CREATETHREAD) ) && !defined (NO_THREADS)
 # define CALLISTO_THREADS
 #endif
 
@@ -53,7 +53,7 @@
 
 /* === C L A S S E S & S T R U C T S ======================================= */
 
-#if defined(CALLISTO_THREADS) && defined(HAVE_PTHREAD_CREATE)
+#if defined(CALLISTO_THREADS) && defined(__ETL_HAS_PTHREAD_CREATE)
 static inline void Yield(void)
 {
        sched_yield();
@@ -68,7 +68,7 @@ inline void Yield(void) { }
 
 #ifdef CALLISTO_THREADS
 
-#ifdef HAVE_PTHREAD_CREATE
+#ifdef __ETL_HAS_PTHREAD_CREATE
 
 class Thread
 {
@@ -108,7 +108,7 @@ public:
                        (*references)++;
                return *this;
        }
-       
+
        void start(void)
        {
                references = new int;
@@ -125,12 +125,12 @@ public:
                pthread_cancel(thread);
                pthread_join(thread,&exit_status);
        }
-       
+
        static void TestStop()
        {
                pthread_testcancel();
        }
-       
+
        static void SyncStop()
        {
                int i;
@@ -207,7 +207,7 @@ public:
        }
 };
 
-#ifdef HAVE_PTHREAD_RW_LOCK_INIT
+#ifdef __ETL_HAS_PTHREAD_RW_LOCK_INIT
 class ReadWriteLock
 {
        pthread_rwlock_t rwlock;
@@ -290,8 +290,8 @@ public:
 };
 */
 
-#else // if defined HAVE_PTHREAD
-#ifdef HAVE_CREATETHREAD
+#else // if defined __ETL_HAS_PTHREAD_CREATE
+#ifdef __ETL_HAS_CREATETHREAD
 
 
 #ifdef THREAD_ENTRYPOINT
@@ -307,18 +307,18 @@ private:
        unsigned long thread;
        HANDLE handle;
        int *references;
-       
+
        entrypoint_return  (THREAD_ENTRYPOINT *entrypoint)(void *);
-       
+
        void *context;
-       
+
        HDC hdc;
        HGLRC hglrc;
-       
+
        static entrypoint_return THREAD_ENTRYPOINT thread_prefix(void*data)
        {
                Thread *thread=(Thread *)data;
-               
+
                if(thread->hglrc)
                        wglMakeCurrent(thread->hdc, thread->hglrc);
 
@@ -356,7 +356,7 @@ public:
                        (*references)++;
                return *this;
        }
-       
+
        void start(void)
        {
                references = new int;
@@ -379,10 +379,10 @@ public:
        {
                delete references;
                references=NULL;
-               
+
                TerminateThread(handle, FALSE);
        }
-       
+
        int wait(void)
        {
                if(handle)
@@ -392,11 +392,11 @@ public:
                }
                return 0;
        }
-       
+
        static void TestStop()
        {
        }
-       
+
        static void SyncStop()
        {
        }
@@ -448,8 +448,8 @@ public:
 };
 
 
-#endif // if defined HAVE_CREATETHREAD
-#endif // if defined HAVE_PTHREAD_CREATE
+#endif // if defined __ETL_HAS_CREATETHREAD
+#endif // if defined __ETL_HAS_PTHREAD_CREATE
 #endif // if defined CALLISTO_THREADS