From: curt Date: Wed, 6 Jun 2001 23:12:03 +0000 (+0000) Subject: Resolve a #define clash with the template argument LOCK. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=29dfc5bd3c78c5e74d21a885ef078796760dec19;p=simgear.git Resolve a #define clash with the template argument LOCK. --- diff --git a/simgear/threads/SGGuard.hxx b/simgear/threads/SGGuard.hxx index 7a890e72..8aadebbc 100644 --- a/simgear/threads/SGGuard.hxx +++ b/simgear/threads/SGGuard.hxx @@ -6,16 +6,16 @@ * An SGGuard object locks its synchronization object during creation and * automatically unlocks it when it goes out of scope. */ -template +template class SGGuard { public: /** * Create an SGGuard object and lock the passed lockable object. - * @param LOCK A lockable object. + * @param SGLOCK A lockable object. */ - inline SGGuard( LOCK& l ) : lock(l) { lock.lock(); } + inline SGGuard( SGLOCK& l ) : lock(l) { lock.lock(); } /** * Destroy this object and unlock the locakable object. @@ -27,12 +27,12 @@ private: /** * A lockable object. */ - LOCK& lock; + SGLOCK& lock; private: // Disable copying. - SGGuard(const LOCK&); - LOCK& operator= (const LOCK&); + SGGuard(const SGLOCK&); + SGLOCK& operator= (const SGLOCK&); }; #endif // SGGUARD_HXX_INCLUDED diff --git a/simgear/threads/SGQueue.hxx b/simgear/threads/SGQueue.hxx index e5c2b280..7a040be4 100644 --- a/simgear/threads/SGQueue.hxx +++ b/simgear/threads/SGQueue.hxx @@ -64,7 +64,7 @@ protected: /** * A simple thread safe queue. All access functions are guarded with a mutex. */ -template +template class SGLockedQueue : public SGQueue { public: @@ -85,7 +85,7 @@ public: * @return bool True if queue is empty, otherwisr false. */ virtual bool empty() { - SGGuard g(mutex); + SGGuard g(mutex); return fifo.empty(); } @@ -95,7 +95,7 @@ public: * @param T object to add. */ virtual void push( const T& item ) { - SGGuard g(mutex); + SGGuard g(mutex); fifo.push( item ); } @@ -105,7 +105,7 @@ public: * @return T next available object. */ virtual T pop() { - SGGuard g(mutex); + SGGuard g(mutex); //if (fifo.empty()) throw NoSuchElementException(); assert( ! fifo.empty() ); // if (fifo.empty()) @@ -122,7 +122,7 @@ private: /** * Mutex to serialise access. */ - LOCK mutex; + SGLOCK mutex; private: // Prevent copying.