From: <sv...@ww...> - 2004-08-08 18:39:38
|
Author: mkrose Date: 2004-08-08 11:39:29 -0700 (Sun, 08 Aug 2004) New Revision: 1210 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/Thread.h Log: Made static thread methods inline to avoid declaring them in multiple translation units (silences a g++ warning). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1210 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-08-08 18:37:28 UTC (rev 1209) +++ trunk/CSP/SimData/CHANGES.current 2004-08-08 18:39:29 UTC (rev 1210) @@ -14,6 +14,9 @@ * Minor logging improvements. + * Made static thread methods inline to avoid declaring them in multiple + translation units (silences a g++ warning). + 2004-07-26: delta * Removed some not needed SIMDATA_EXPORT for vs 7.1. Modified: trunk/CSP/SimData/Include/SimData/Thread.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Thread.h 2004-08-08 18:37:28 UTC (rev 1209) +++ trunk/CSP/SimData/Include/SimData/Thread.h 2004-08-08 18:39:29 UTC (rev 1210) @@ -54,7 +54,7 @@ * or higher priority. If no such threads are available, the calling * thread continues immediately. */ - static int yield() { + static inline int yield() { return sched_yield(); } @@ -64,14 +64,14 @@ /** Terminate the currently executing thread. */ - static void exit() { + static inline void exit() { pthread_exit(0); } /** Set the thread cancellation state to enabled. Requests to cancel * this thread will be honored. */ - static void enableCancel() { + static inline void enableCancel() { const int result = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0); ThreadException::checkThrow(result); } @@ -79,7 +79,7 @@ /** Set the thread cancellation state to disabled. Requests to cancel * this thread will be remain pending until cancellation is reenabled. */ - static void disableCancel() { + static inline void disableCancel() { const int result = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0); ThreadException::checkThrow(result); } @@ -89,7 +89,7 @@ * at cancellation points (most blocking functions). * @see Thread::cancel(). */ - static void testCancel() { + static inline void testCancel() { pthread_testcancel(); } @@ -99,7 +99,7 @@ * Asynchronous cancellation should only be used in very tight loops, * where calls to testCancel would be too expensive. */ - static void useAsynchronousCancel() { + static inline void useAsynchronousCancel() { const int result = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); ThreadException::checkThrow(result); } @@ -108,7 +108,7 @@ * deferred until a cancellation point is reached, i.e most blocking functions * or an explicit call to testCancel(). */ - static void useDeferredCancel() { + static inline void useDeferredCancel() { const int result = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0); ThreadException::checkThrow(result); } @@ -118,7 +118,7 @@ * @param seconds seconds to pause (fractional values ok, but limited by * the granularity of the operating system's time slices). */ - static void sleep(double seconds) { + static inline void sleep(double seconds) { static ThreadCondition m_condition; ScopedLock<ThreadCondition> lock(m_condition); m_condition.wait(seconds); @@ -408,8 +408,8 @@ } private: + Ref<Task> m_task; Task::ThreadId m_thread_id; - Ref<Task> m_task; bool m_cancelled; }; |