Add support for node limited search

Handle also the SMP case. This has been quite tricky, not
trivial to enforce the node limit in SMP case becuase
with "helpful master" concept we can have recursive split
points and we cannot lock them all at once so there is the
risk of counting the same nodes more than once.

Anyhow this patch should be race free and counted nodes are
correct.

No functional change.
This commit is contained in:
Marco Costalba
2012-09-30 06:49:56 +02:00
parent e5463eb3ae
commit ed0fb0b05f
3 changed files with 48 additions and 12 deletions

View File

@@ -75,6 +75,7 @@ struct SplitPoint {
// Shared data
Mutex mutex;
Position* activePositions[MAX_THREADS];
volatile uint64_t slavesMask;
volatile int64_t nodes;
volatile Value alpha;
@@ -153,6 +154,7 @@ public:
Depth depth, Move threatMove, int moveCount, MovePicker* mp, int nodeType);
private:
friend class Thread;
friend void check_time();
std::vector<Thread*> threads;
Thread* timer;