Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx>
- Date: Sat, 29 Mar 2008 16:08:47 -0700 (PDT)
On Mar 29, 11:42 pm, vit...@xxxxxxxxx wrote:
while {$check} {
fcopy $in $out -command [list CopyMore $in $out $size] -size $size
}
vwait done
When I run it I get the following error: channel "file3" is busy
Well, maybe you could read that manpage once more :-)
When fcopy has a -command, it is *asynchronous*, which means:
- sets up internal fileevents and nonblocking modes
- (also prevents any further fileevents and IO on the two channels)
- returns immediately
Your [while] loop (which by the way at least two persons have asked
you to remove) then tries to repeatedly register that asynchronous
operation. Of course the [fcopy] here runs exactly twice: one which
works, and one which raises the "busy" error you reported.
What you want is rather:
proc StartOneChunk s {
fcopy -command CopyMore -size $s ...
}
# prime the pump, just once
StartOneChunk $size
proc CopyMore args {
if {finished} {set ::done 1;return}
StartOneChunk $::size
}
vwait done
-Alex
.
- Follow-Ups:
- References:
- serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Bruce Hartweg
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Alan Anderson
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Alexandre Ferrieux
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Darren New
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Prev by Date: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Next by Date: Update using teacup
- Previous by thread: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Next by thread: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Index(es):
Relevant Pages
|