Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ca3eba570d2bc937f0b116c6ad29001dcb204d08
Ticket: 577014ffffffffffffffffffffffffffffffffff
documentation; wait on thread exits
User & Date: elfring on 2002-08-06 07:56:21
Changes

  1. icomment:
    Logged In: YES 
    user_id=572001
    
    Well, I've got another idea.
    
    When we talk about shell background 
    processes, then we talk also about the "special" case that there is only one 
    foreground process. I think that the shell command "wait" does nothing more 
    than to wait until one process is left running again.
    
    How can we map 
    this situation to threads?
    I think that it's unusual to talk about foreground 
    and background threads because all threads are executed at the same level. 
    We divide threads by their responsibility. But it's more common to call them 
    manager and worker threads. Several manager threads that delegate jobs to 
    the worker threads are started at the beginning of a process.
    My goal is to 
    achieve a situation where the set of running threads is the same after some 
    worker threads were executed. I would like the function "thread::wait" to be 
    adjusted so that it does an other wait instead of an "vwait". I suggest the 
    following function calls.
    
    # Store current thread situation
    set 
    foreground [thread::names]
    
    # Create some "background"/worker 
    threads
    foreach t {function1 function2 function3} {thread::create 
    $t}
    
    # Wait until the additional threads finished execution by waiting 
    that the list of running threats will be "restored".
    thread::wait -on IDs 
    $foreground
    
    
  2. login: "elfring"
  3. mimetype: "text/plain"
  4. username: "elfring"