Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Gets blocks in a readable fileevent

Closed / Fixed218553ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:02:05
OriginalBugID: 1051 Bug
Version: 8.1b1
SubmitDate: '1999-01-15'
LastModified: '1999-03-23'
Severity: CRIT
Status: Released
Submitter: pat
ChangedBy: redman
OS: Windows 95
Machine: X86
FixedDate: '1999-03-23'
ClosedDate: '2000-10-25'


Name:
Graham Haley

ReproducibleScript:
Set up a readable fileevent handler on stdin ...

fileevent stdin readable {
    puts "handler fired"
    if {[gets stdin line] >= 0} {
        puts "$line"
    } else {
        puts "gets failed"
    }
}

and configure stdin to be non-blocking/line-buffered ...

fconfigure stdin -blocking 0 -buffering line

Process events ...

set result 0
vwait result

The handler immediately fires and gets blocks waiting for data.  When it
arrives, gets returns, prints it and immediately fires again.

Surely this is wrong - the whole point of having an event handler is to
prevent gets from blocking.

This works ok on Solaris.



ObservedBehavior:
gets hangs



DesiredBehavior:
The event handler should only be called if there is data to read (and hence
gets shouldn't block)




03/23/1999 16:05 - redman - Fixed tclWinConsole.c, fileevents are now firing when an entire line is available.  Test case in tests/winConsole.test.
welch Closed ticket [218553ffff]. [History diff]2000-10-26 08:24:14
dgp Ticket [218553ffff]: 3 changes [History diff]2001-04-17 04:44:06
Log in (anonymous is fine) to add a comment.