Retire spinlocks

Use Mutex instead.

This is in preparaation for merging with master branch,
where we stilll don't have spinlocks.

Eventually spinlocks will be readded in some future
patch, once c++11 has been merged.

No functional change.
This commit is contained in:
Marco Costalba
2015-03-10 21:50:45 +01:00
parent 6027652773
commit 4b59347194
3 changed files with 27 additions and 39 deletions

View File

@@ -41,18 +41,6 @@ const size_t MAX_SPLITPOINTS_PER_THREAD = 8;
const size_t MAX_SLAVES_PER_SPLITPOINT = 4;
/// Spinlock class wraps low level atomic operations to provide a spin lock
class Spinlock {
Mutex m; // WARNING: Diasabled spinlocks to test on fishtest
public:
void acquire() { m.lock(); }
void release() { m.unlock(); }
};
/// SplitPoint struct stores information shared by the threads searching in
/// parallel below the same split point. It is populated at splitting time.
@@ -72,7 +60,7 @@ struct SplitPoint {
SplitPoint* parentSplitPoint;
// Shared variable data
Spinlock spinlock;
Mutex mutex;
std::bitset<MAX_THREADS> slavesMask;
volatile bool allSlavesSearching;
volatile uint64_t nodes;
@@ -163,7 +151,7 @@ struct ThreadPool : public std::vector<Thread*> {
void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&);
Depth minimumSplitDepth;
Spinlock spinlock;
Mutex mutex;
ConditionVariable sleepCondition;
TimerThread* timer;
};