Artifact
3142c947793d378235f43231308978fde3b3b180c04077892099ae1ed1485b71:
Attachment "flushchannel.tcl" to
ticket [d481f15516]
added by
anonymous
2019-12-27 11:21:54.
#!/usr/bin/tclsh
package require Thread
proc connected {fd} {
close $fd
exit
}
# True: use main thread, False: use helper thread
if {false} {
set sock [socket -async dns.google 53]
} else {
set tid [thread::create]
set sock [thread::send $tid {
set fd [socket -async dns.google 53]
thread::detach $fd
set fd
}]
thread::attach $sock
}
fileevent $sock writable [list connected $sock]
vwait forever