mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Update tests and CI (#979)
Update CI. Explicit native mutex "initialized" bool.
This commit is contained in:
committed by
GitHub
parent
50e99b571f
commit
b87e27d8a3
@@ -15,18 +15,19 @@ fn void! testrun() @test
|
||||
assert(t.join()! == 10);
|
||||
}
|
||||
|
||||
Mutex m;
|
||||
|
||||
Mutex m_global;
|
||||
|
||||
fn void! testrun_mutex() @test
|
||||
{
|
||||
Thread[20] ts;
|
||||
a = 0;
|
||||
m.init()!;
|
||||
m_global.init()!;
|
||||
foreach (&t : ts)
|
||||
{
|
||||
t.create(fn int(void* arg) {
|
||||
m.lock()!!;
|
||||
defer m.unlock()!!;
|
||||
m_global.lock()!!;
|
||||
defer m_global.unlock()!!;
|
||||
a += 10;
|
||||
thread::sleep_ms(5);
|
||||
a *= 10;
|
||||
@@ -44,7 +45,7 @@ fn void! testrun_mutex() @test
|
||||
assert(t.join()! == 0);
|
||||
}
|
||||
assert(a == ts.len);
|
||||
m.destroy()!;
|
||||
m_global.destroy()!;
|
||||
}
|
||||
|
||||
fn void! testrun_mutex_try() @test
|
||||
|
||||
Reference in New Issue
Block a user