mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Updates. Create a class to hold an item in a SHAMap, separating the tag from
the data (it's not always the hash of the data). Make ScopedLock's recursive.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef __SCOPEDLOCKHOLDER__
|
||||
#define __SCOPEDLOCKHOLDER__
|
||||
|
||||
#include "boost/thread/mutex.hpp"
|
||||
#include "boost/thread/recursive_mutex.hpp"
|
||||
|
||||
// This is a returnable lock holder.
|
||||
// I don't know why Boost doesn't provide a good way to do this.
|
||||
@@ -9,13 +9,13 @@
|
||||
class ScopedLock
|
||||
{
|
||||
private:
|
||||
boost::mutex *mMutex; // parent object has greater scope, so guaranteed valid
|
||||
boost::recursive_mutex *mMutex; // parent object has greater scope, so guaranteed valid
|
||||
mutable bool mValid;
|
||||
|
||||
ScopedLock(); // no implementation
|
||||
|
||||
public:
|
||||
ScopedLock(boost::mutex &mutex) : mMutex(&mutex), mValid(true)
|
||||
ScopedLock(boost::recursive_mutex &mutex) : mMutex(&mutex), mValid(true)
|
||||
{
|
||||
mMutex->lock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user