Re: fileevent saying there's something to read but there isn't ?!
- From: David Gravereaux <davygrvy@xxxxxxxxx>
- Date: Thu, 25 May 2006 16:51:37 -0700
On 25 May 2006 13:40:41 -0500, rugger@xxxxxxxxxxxx (Kip Rugger) wrote:
David Gravereaux <davygrvy@xxxxxxxxx> wrote:
Yet who is the responsible party to develop that event that the
fileevent callback requires?
There are two ideas of operating-system design in play here.
First, how is synchronization done? There are several models that
have emerged over the years:
- n-way wait (Unix select(2), MVS ecb lists)
- event lists (BSD kqueue(2), QNX mailboxes, Tcl, X event protocol)
- callbacks (Windows).
Secondly is the basic concept that flow control must be exercised by
the upstream client -- you tell the client that data can be read
rather than forcing the client to accept the actual data itself; the
client actively accepts the data when resources permit.
The fileevent behaviour is a byproduct of the early n-way wait
primitives. After the wait is satisfied, you essentially poll the
underlying files for their status. This polling is stateless in the
sense that there is no attempt to prevent previously reported status
from being reported again. That is source of the familiar
read-ready/EOF infinite loops that incorrect scripts can experience.
By contrast, the event-list primitives tend naturally not to
re-report. Indeed re-reporting would cause chaos for events such as
mouse clicks, etc. In general you can think of events as being a
vehicle for maintaining a slave copy of a master data-structure -- the
event stream reports the changes to the master so that they can be
replicated in the slave. (Of course this is an abstract
data-structure; its contents are specified but not its format.)
The case at hand is a layering problem: at what layer of the channel
implementation should the translation from n-way semantics to event
semantics occur. Because this translation is not desirable for
anything but files (and even there only for historical reasons), I
would suggest that the answer is that the caller of CreateEventSource
would be the highest layer at which it could logically occur. Or
perhaps a CreateFileeventSource service that implements the polling
behaviour.
I am now experiencing that rant feeling :)
Thanks Kip. So that's where that behavior comes from.. Now I'm
thinking about maintaining a second list of "eof, but unclosed"
sockets to query [count != 0] in the Tcl_EventSetupProc. That should
do it as I won't have to manufacture things as the polling to it Tcl
already provides.
Thanks.
.
- References:
- fileevent saying there's something to read but there isn't ?!
- From: Frank Goenninger DG1SBG
- Re: fileevent saying there's something to read but there isn't ?!
- From: David Gravereaux
- Re: fileevent saying there's something to read but there isn't ?!
- From: Robert Heller
- Re: fileevent saying there's something to read but there isn't ?!
- From: David Gravereaux
- Re: fileevent saying there's something to read but there isn't ?!
- From: Kip Rugger
- fileevent saying there's something to read but there isn't ?!
- Prev by Date: Re: The Tcl notifier and Console on Windows
- Next by Date: Re: destroy . stumper
- Previous by thread: Re: fileevent saying there's something to read but there isn't ?!
- Next by thread: Re: fileevent saying there's something to read but there isn't ?!
- Index(es):
Relevant Pages
|