mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Check for mutex initialization. Fix missing check on optional for certain macro situations.
This commit is contained in:
@@ -5,7 +5,7 @@ fn void! testrun() @test
|
||||
{
|
||||
Thread t;
|
||||
a = 0;
|
||||
t.create(fn int(void* arg) { a++; return 0; }, null);
|
||||
t.create(fn int(void* arg) { a++; return 0; }, null)!;
|
||||
assert(t.join()! == 0);
|
||||
assert(a == 1);
|
||||
}
|
||||
@@ -16,11 +16,11 @@ fn void! testrun_mutex() @test
|
||||
{
|
||||
Thread[100] ts;
|
||||
a = 0;
|
||||
m.init(thread::MUTEX_PLAIN);
|
||||
m.init(thread::MUTEX_PLAIN)!;
|
||||
foreach (&t : ts)
|
||||
{
|
||||
t.create(fn int(void* arg) {
|
||||
m.lock();
|
||||
m.lock()!!;
|
||||
defer m.unlock()!!;
|
||||
a += 10;
|
||||
thread::sleep_ms(5);
|
||||
@@ -32,7 +32,7 @@ fn void! testrun_mutex() @test
|
||||
thread::sleep_ms(5);
|
||||
a++;
|
||||
return 0;
|
||||
}, null);
|
||||
}, null)!;
|
||||
}
|
||||
foreach (i, &t : ts)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user