#include <osg/PointSprite>
#include <osg/Texture>
+#include <OpenThreads/Mutex>
+#include <OpenThreads/ScopedLock>
+
#include <simgear/structure/SGSharedPtr.hxx>
-#include <simgear/threads/SGThread.hxx>
-#include <simgear/threads/SGGuard.hxx>
SGSceneFeatures::SGSceneFeatures() :
_textureCompression(UseARBCompression),
{
}
-static SGMutex mutexSGSceneFeatures_instance;
+static OpenThreads::Mutex mutexSGSceneFeatures_instance;
SGSceneFeatures*
SGSceneFeatures::instance()
{
static SGSharedPtr<SGSceneFeatures> sceneFeatures;
if (sceneFeatures)
return sceneFeatures;
- SGGuard<SGMutex> guard(mutexSGSceneFeatures_instance);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutexSGSceneFeatures_instance);
if (sceneFeatures)
return sceneFeatures;
sceneFeatures = new SGSceneFeatures;
#include <cassert>
#include <queue>
-#include "SGThread.hxx"
-#include "SGGuard.hxx"
+#include <OpenThreads/Mutex>
+#include <OpenThreads/ScopedLock>
+#include <OpenThreads/Condition>
/**
* SGQueue defines an interface for a FIFO.
/**
* A simple thread safe queue. All access functions are guarded with a mutex.
*/
-template<class T, class SGLOCK=SGMutex>
+template<class T, class SGLOCK=OpenThreads::Mutex>
class SGLockedQueue : public SGQueue<T>
{
public:
* @return bool True if queue is empty, otherwisr false.
*/
virtual bool empty() {
- SGGuard<SGLOCK> g(mutex);
+ OpenThreads::ScopedLock<SGLOCK> g(mutex);
return this->fifo.empty();
}
* @param T object to add.
*/
virtual void push( const T& item ) {
- SGGuard<SGLOCK> g(mutex);
+ OpenThreads::ScopedLock<SGLOCK> g(mutex);
this->fifo.push( item );
}
* @return T next available object.
*/
virtual T front() {
- SGGuard<SGLOCK> g(mutex);
+ OpenThreads::ScopedLock<SGLOCK> g(mutex);
assert( ! this->fifo.empty() );
T item = this->fifo.front();
return item;
* @return T next available object.
*/
virtual T pop() {
- SGGuard<SGLOCK> g(mutex);
+ OpenThreads::ScopedLock<SGLOCK> g(mutex);
//if (fifo.empty()) throw NoSuchElementException();
assert( ! this->fifo.empty() );
// if (fifo.empty())
* @return size_t size of queue.
*/
virtual size_t size() {
- SGGuard<SGLOCK> g(mutex);
+ OpenThreads::ScopedLock<SGLOCK> g(mutex);
return this->fifo.size();
}
*
*/
virtual bool empty() {
- SGGuard<SGMutex> g(mutex);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> g(mutex);
return this->fifo.empty();
}
* @param T object to add.
*/
virtual void push( const T& item ) {
- SGGuard<SGMutex> g(mutex);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> g(mutex);
this->fifo.push( item );
not_empty.signal();
}
* @return T next available object.
*/
virtual T front() {
- SGGuard<SGMutex> g(mutex);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> g(mutex);
assert(this->fifo.empty() != true);
//if (fifo.empty()) throw ??
* @return T next available object.
*/
virtual T pop() {
- SGGuard<SGMutex> g(mutex);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> g(mutex);
while (this->fifo.empty())
- not_empty.wait(mutex);
+ not_empty.wait(&mutex);
assert(this->fifo.empty() != true);
//if (fifo.empty()) throw ??
* @return size_t size of queue.
*/
virtual size_t size() {
- SGGuard<SGMutex> g(mutex);
+ OpenThreads::ScopedLock<OpenThreads::Mutex> g(mutex);
return this->fifo.size();
}
/**
* Mutex to serialise access.
*/
- SGMutex mutex;
+ OpenThreads::Mutex mutex;
/**
* Condition to signal when queue not empty.
*/
- SGPthreadCond not_empty;
+ OpenThreads::Condition not_empty;
private:
// Prevent copying.