mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Remove unnecessary conditions from if-clauses and replace them with asserts
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
80810e4951
commit
12feb5866f
1 changed files with 5 additions and 4 deletions
|
@ -2583,17 +2583,18 @@ namespace {
|
||||||
{
|
{
|
||||||
// Slave threads can exit as soon as AllThreadsShouldExit raises,
|
// Slave threads can exit as soon as AllThreadsShouldExit raises,
|
||||||
// master should exit as last one.
|
// master should exit as last one.
|
||||||
if (AllThreadsShouldExit && !waitSp)
|
if (AllThreadsShouldExit)
|
||||||
{
|
{
|
||||||
|
assert(!waitSp);
|
||||||
threads[threadID].state = THREAD_TERMINATED;
|
threads[threadID].state = THREAD_TERMINATED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are not thinking, wait for a condition to be signaled
|
// If we are not thinking, wait for a condition to be signaled
|
||||||
// instead of wasting CPU time polling for work.
|
// instead of wasting CPU time polling for work.
|
||||||
while ( threadID != 0
|
while (AllThreadsShouldSleep || threadID >= ActiveThreads)
|
||||||
&& (AllThreadsShouldSleep || threadID >= ActiveThreads))
|
|
||||||
{
|
{
|
||||||
|
assert(threadID != 0);
|
||||||
threads[threadID].state = THREAD_SLEEPING;
|
threads[threadID].state = THREAD_SLEEPING;
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER)
|
||||||
|
@ -2613,7 +2614,7 @@ namespace {
|
||||||
// If this thread has been assigned work, launch a search
|
// If this thread has been assigned work, launch a search
|
||||||
if (threads[threadID].state == THREAD_WORKISWAITING)
|
if (threads[threadID].state == THREAD_WORKISWAITING)
|
||||||
{
|
{
|
||||||
assert(!AllThreadsShouldExit);
|
assert(!AllThreadsShouldExit && !AllThreadsShouldSleep);
|
||||||
|
|
||||||
threads[threadID].state = THREAD_SEARCHING;
|
threads[threadID].state = THREAD_SEARCHING;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue