| 145 | */ |
| 146 | template<class Tracer> |
| 147 | forceinline void |
| 148 | BAB<Tracer>::Worker::find(void) { |
| 149 | // Try to find new work (even if there is none) |
| 150 | for (unsigned int i=0U; i<engine().workers(); i++) { |
| 151 | unsigned long int r_d = 0ul; |
| 152 | typename Engine<Tracer>::Worker* wi = engine().worker(i); |
| 153 | if (Space* s = wi->steal(r_d,wi->tracer,tracer)) { |
| 154 | // Reset this guy |
| 155 | m.acquire(); |
| 156 | idle = false; |
| 157 | // Not idle but also does not have the root of the tree |
| 158 | path.ngdl(0); |
| 159 | d = 0; |
| 160 | cur = s; |
| 161 | mark = 0; |
| 162 | if (best != nullptr) |
| 163 | cur->constrain(*best); |
| 164 | Statistics t = *this; |
| 165 | Search::Worker::reset(r_d); |
| 166 | (*this) += t; |
| 167 | m.release(); |
| 168 | return; |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | * Statistics |