Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-06-30
22:31 • Closed ticket [1512225fff]: tpool::wait and tpool::cancel set wrong value to var... artifact: a5216b6798 user: vasiljevic
22:29 • Ticket [1512225fff]: 4 changes artifact: 994f190f33 user: vasiljevic
2006-06-26
01:38 • Add attachment threadPoolCmd.c.patch to ticket [1512225fffffffff|151222... artifact: 7b379af435 user: nyademo
01:38 • Ticket [1512225fff] tpool::wait and tpool::cancel set wrong value to variable</i... artifact: da0f89114b user: nyademo
2006-06-25
18:38 • New ticket [1512225fff]. artifact: b8dcf95d89 user: nyademo

tpool::wait and tpool::cancel set wrong value to variable

Closed / Fixed1512225fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 19 years ago
Descriptionplain2006-06-25 18:38:22
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.
nyademoplain2006-06-26 01:38:22
File Added - 182941: threadPoolCmd.c.patch
vasiljevicplain2007-06-30 22:29:52
Logged In: YES 
user_id=95086
Originator: NO

Great work! Many thanks for the patch
and your time. I have added this into the
CVS head. Please checkout and see if
all is fine. Your test programs work as
expected now. The fixed will appear first
in 2.6.6 version.

Cheers,
Zoran
vasiljevic Closed ticket [1512225fff]. [History diff]2007-06-30 22:31:16
Log in (anonymous is fine) to add a comment.

Attachments: