Created
November 11, 2016 18:20
-
-
Save bovine/47d5b36d614dfc42af8ed4cddda121fe to your computer and use it in GitHub Desktop.
tpool::post hangs if the maximum number of workers has already been reached, but they have all exited already
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/tclsh | |
package require Thread | |
# initialize the thread pool | |
set mypool [tpool::create -minworkers 1 -maxworkers 5] | |
# queue up something that exits the thread. | |
# this will be unable to process more than 5 events because all of the workers have gone away. | |
for {set i 0} {$i < 10} {incr i} { | |
tpool::post $mypool "puts \"hello $i\"; thread::exit" | |
} | |
tpool::release $mypool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
admittedly, using thread::exit within a tpool is not a normal or recommended activity, but maybe this should be handled and detected better.