Skip to content

tid.isDone() not working #131

Closed
Closed
@leepc12

Description

@leepc12

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions