Closed
Description
For tasks executed in par
function, tid.isDone() does not work. You can run the following example to replicate this error.
#!/usr/bin/env bds
string[] tids_all
sleep_sec := 2 help sleep_sec
num_rep := 16 help num_rep
nth_spp := 3 help nth_spp
nth := 10 help nth
par spp()
wait
for ( string tid : tids_all ) {
print("\t$tid : "+tid.isDone()+", "+tid.isDoneOk()+", "+tid.exitCode()+"\n")
}
void spp() {
for (int i=1; i<=num_rep; i++) spp_sub(i)
}
void spp_sub(int i) {
time := min(i,sleep_sec)
taskName := "spp $i"
tid := task {
sys echo $(date)": spp $i started."
sys sleep $time
sys echo $(date)": spp $i done."
}
register_par( tid, nth_spp )
}
void register_par( string tid, int nth_task ) {
if ( tid == "" ) return
tids_all.add(tid)
}
Metadata
Metadata
Assignees
Labels
No labels