Moved cpp code to src/cpp and js code to src/js.

This commit is contained in:
Stefan Thomas
2012-11-06 12:02:59 -08:00
parent 3c880b8301
commit fa3fab5816
214 changed files with 62 additions and 57 deletions

View File

@@ -0,0 +1,31 @@
#ifndef __SCOPEDLOCKHOLDER__
#define __SCOPEDLOCKHOLDER__
#include <boost/thread/recursive_mutex.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/ref.hpp>
// A lock holder that can be returned and copied by value
// When the last reference goes away, the lock is released
class ScopedLock
{
protected:
mutable boost::shared_ptr<boost::recursive_mutex::scoped_lock> mHolder;
public:
ScopedLock(boost::recursive_mutex& mutex) :
mHolder(boost::make_shared<boost::recursive_mutex::scoped_lock>(boost::ref(mutex)))
{ ; }
void lock() const
{
mHolder->lock();
}
void unlock() const
{
mHolder->unlock();
}
};
#endif