package require Thread
set script {
    thread::send %s [list set flag 1]
}
set script [format $script [thread::id]]
set pid [tpool::create -maxworkers 1]
set flag 0
while { !$flag } {
    puts [tpool::post $pid $script]
    puts [thread::names]
}
tpool::release $pid

since only one worker is allowed in this case, there will be only two jobs generated by tpool.
at the every beginning, the worker picks the first job and expect to set the flag in main thread.
Meanwhile, the main thread waits in event loop until the woker set the flag successfully and takes the second job from the pool.
Then the main thread won't post anymore job because flag is set.

However, I got confused by receiving the following result:
1
tid00000548
2
tid00000548
3
tid00000548
4
tid00000548
5
tid00000548
6
tid00000510 tid00000548
7
tid00000510 tid00000548
can anyone explain this? thanks a lot