Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b8dcf95d89e71014824e85554ec9c1a8ccdbac32
Ticket: 1512225fffffffffffffffffffffffffffffffff
tpool::wait and tpool::cancel set wrong value to variable
User & Date: nyademo on 2006-06-25 18:38:22
Changes

  1. assignee changed to: "vasiljevic"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    tpool::wait and tpool::cancel set wrong value to
    optional variable.
    
    
    Windows2000
    ActiveTcl8.4.13
    Thread2.6.3 compiled by VC6
    
    
    Sample code for tpool::wait
    -------------------------------------------------------
    set tp [tpool::create -maxworkers 1]
    for {set i 1} {$i < 10} {incr i} {
    puts [tpool::post -nowait $tp [subst {
    puts $i:start
    after 5000
    puts $i:end
    }]]
    }
    puts [tpool::wait $tp {4 5 6} waiting]:DONE
    if {[llength $waiting] != 2} {
    error "waiting is $waiting"
    }
    
    
    In this code, only one worker thread is worked.
    So posted jobs are eval one by one.
    When the 4 job is finishing, tpool::wait returns from 
    event loop, and returns number 4, 
    and should set a list of waiting jobs (5 and 6) 
    to "waiting" variable.
    But "waiting" variable is empty list.
    
    
    Sample code for tpool::wait
    -------------------------------------------------------
    set tp [tpool::create -maxworkers 1]
    for {set i 1} {$i < 10} {incr i} {
    puts [tpool::post -nowait $tp [subst {
    puts $i:start
    after 1000
    puts $i:end
    }]]
    }
    after 5000
    # jobs 1,2,3 was already done here
    tpool::cancel $tp {1 2 3} uncanceled
    if {$uncanceled ne {1 2 3}} {
    # may be $uncanceled is {1 1 1 2 2 2 3 3 3}
    error "uncanceled is $uncanceled"
    }
    
    
    In this code, only one worker thread is worked.
    So posted jobs are eval one by one.
    After The 1, 2 and 3 jobs are finished, tpool::cancel 
    is called. So 1,2,3 jobs can't be canceled.
    tpool::cancel returns empty list and should set a list
    of uncanceled jobs (1,2 and 3) to "uncanceled" variable.
    But "uncanceled" variable is {1 1 1 2 2 2 3 3 3} 
    in this case.
    
    
    There isn't a test, so I have no confidence 
    in detail of specifications... 
    But I try to make a pach. see also that.
    
    thanks.
    
  4. foundin changed to: "obsolete: 8.4.13"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nyademo"
  9. subsystem changed to: "80. Thread Package"
  10. title changed to:
    tpool::wait and tpool::cancel set wrong value to variable
    
  11. type changed to: "Bug"