Skip to content
Tcl Source Code View Ticket
Login

View Ticket

thread::transfer cause exception

Closed / Duplicate1021053fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-09-02 10:06:24
unning this script on windows xp Home
tcl 8.4.7 threaded 
thread version 2.6

when trying to read from a socket after it was 
transfered to the thread using "thread::transfer" I get 
exception. the same happens with "thread::attach" 
and "thread::detach"

here is the script:

package require Thread

proc acceptRequest {sock ip port} {
after idle [list handleRequest $sock $ip $port 
[thread::id]]
}

proc handleRequest {sock ip port mainThreadId} {
puts "$sock $ip $port"
global threadId
#thread::detach $sock
thread::transfer $threadId $sock
thread::send $threadId [list doSock $sock]
}
set threadId [thread::create]
thread::send $threadId {
proc doSock {sock}  {
#thread::attach $sock
puts [gets $sock 1]
close $sock
}
}
set sock [socket -server acceptRequest 7790]
vwait foreve
dkf Closed ticket [1021053fff]. [History diff]2004-09-02 19:11:39
Log in (anonymous is fine) to add a comment.