returns first available stream to read or write to

return null on interruption (possibly a signal)

Property definitions

core :: file $ Sys :: poll
	# returns first available stream to read or write to
	# return null on interruption (possibly a signal)
	protected fun poll( streams : Sequence[FileStream] ) : nullable FileStream
	do
		var in_fds = new Array[Int]
		var out_fds = new Array[Int]
		var fd_to_stream = new HashMap[Int,FileStream]
		for s in streams do
			var fd = s.fd
			if s isa FileReader then in_fds.add( fd )
			if s isa FileWriter then out_fds.add( fd )

			fd_to_stream[fd] = s
		end

		var polled_fd = intern_poll( in_fds, out_fds )

		if polled_fd == null then
			return null
		else
			return fd_to_stream[polled_fd]
		end
	end
lib/core/file.nit:1609,2--1631,4