usa / ruby-lang.org wrote:
>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63008
> 
>   Log:
>     get rid of test error/failure on Windows introduced at r62955
>     
>     * lib/webrick/httpresponse.rb (send_body_io): use seek if NotImplementedError
>       is raised in IO.copy_stream with offset.

I guess Windows does not have pread?  The main advantage pread
has over lseek+read is its atomic, even with respect to shared
FDs across multiple processes.  This is important to *nix where
FDs are shared on fork.

AFAIK, Windows has no fork, so the only FDs which can be shared
are [0,1,2].  If there is no fork, the following sequence should
be atomic for FD > 2:

	# only reliable facsimile for pread iff FDs are not shared across fork
	lock
	lseek
	read
	unlock

For current C Ruby, lock/unlock can use GVL.  So I think that
workaround can be implemented for Windows in IO.copy_stream
itself, and not WEBrick.

Thanks.

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>