finished mthread polymorphisim, moving onto revamping syncronization
This commit is contained in:
parent
3b97e627ca
commit
e6cf67d4ed
@ -90,7 +90,7 @@ bool mthread::find_work() {
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
//find the worker who has the biggest workload
|
//find the worker who has the biggest workload
|
||||||
worker = distance(loads, max_element(loads, &loads[worker_cnt]));
|
worker = distance(loads, max_element(loads, &loads[worker_cnt]));
|
||||||
if(!loads[worker]) break; //we have found a worker; distance is 0
|
if(!loads[worker]) return true; //we have found a worker; distance is 0
|
||||||
peer_status = &workers[worker]->status;
|
peer_status = &workers[worker]->status;
|
||||||
peer_status->status_lock.lock();
|
peer_status->status_lock.lock();
|
||||||
//check to see if canidate is valid.
|
//check to see if canidate is valid.
|
||||||
@ -124,7 +124,7 @@ bool mthread::find_work() {
|
|||||||
status.status_lock.lock();
|
status.status_lock.lock();
|
||||||
status.searching = false;
|
status.searching = false;
|
||||||
status.status_lock.unlock();
|
status.status_lock.unlock();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user