Skip to content
Snippets Groups Projects
  • Glauber Costa's avatar
    b0dc3f1a
    tests: fix threads being destroyed earlier. · b0dc3f1a
    Glauber Costa authored
    
    The last part of the standard thread tests created 4 threads and calls the
    detach of one from the body of the other. They live in the same block to
    guarantee that they will all be destroyed more or less at the same time (we
    expect). Avi, however, demonstrated that a mistake prevents that from being
    the actual case:
    
        t1 starts to run
        t2 starts to run
        t3 starts to run
        t4 starts to run
        t4 is detached
        t4 is destroyed (ok)
        t3 is destroyed. wasn't detached or join, to terminate
        t1, t2, t3 are detached, but too late
    
    This introduces a simple wait mechanism to avoid having the threads
    terminated after the block is gone.
    
    Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    b0dc3f1a
    History
    tests: fix threads being destroyed earlier.
    Glauber Costa authored
    
    The last part of the standard thread tests created 4 threads and calls the
    detach of one from the body of the other. They live in the same block to
    guarantee that they will all be destroyed more or less at the same time (we
    expect). Avi, however, demonstrated that a mistake prevents that from being
    the actual case:
    
        t1 starts to run
        t2 starts to run
        t3 starts to run
        t4 starts to run
        t4 is detached
        t4 is destroyed (ok)
        t3 is destroyed. wasn't detached or join, to terminate
        t1, t2, t3 are detached, but too late
    
    This introduces a simple wait mechanism to avoid having the threads
    terminated after the block is gone.
    
    Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>