1 Feb 2012 14:20
pthread issues
Pthreads are not working right. tools/launcg crashes,
and this program fails to do what I expect:
// pthread test
noinline proc mkfibre(p:int, f:int) {
spawn_fthread {
for k in 1 upto 10 do
eprint$ "Thr " + str p + " fibre " + str f + " step " + str k + "\n";
//Faio::sleep(sys_clock, 0.01 + f.double / 5.0);
done
eprint$ "Thr " + str p + " fibre " + str f + " DEAD " + "="*20+"\n";
};
}
noinline proc mkthread (x:int) {
spawn_pthread {
for var j in 1 upto 10 do
eprint$ "Thr " + str x + " step " + str j + "\n";
//Faio::sleep(sys_clock, 0.1 + x.double / 2.0);
for var f in 0 upto 10 do
mkfibre(x, f);
done
done
print$ "Thread " + str x + " done" + "*"*20+"\n";
};
}
for var k in 1 upto 10 do
mkthread k;
(Continue reading)
RSS Feed