test simple-sync: avoid a race condition in output checking by using an assert

This commit is contained in:
Michael Ploujnikov 2010-02-10 20:47:13 -05:00
parent 62b70bfd7e
commit d80ae17ea4
2 changed files with 2 additions and 2 deletions

View file

@ -27,7 +27,6 @@ END
TEST "simple sync" simple-sync <<END
err: syncing with the other thread
err: the other thread received its arguments
err: result is 0
END

View file

@ -59,6 +59,7 @@ void other_fn(void * arg)
{
int input = *(int *)arg;
lumiera_thread_sync (); // the main thread can discard the argument storage
CHECK (input == 42, "input is not 42, but %d", input);
input -= 42;
ECHO ("result is %d", input);
}
@ -288,8 +289,8 @@ TEST ("simple-sync")
ECHO ("syncing with the other thread");
lumiera_thread_sync_other (other);
ECHO ("the other thread received its arguments");
value += 42;
CHECK (value == 42*2, "value is not equal to 42*2=84, but %d", value);
lumiera_threadpool_destroy ();
}