From 8005a1ea0359cc32b78d70f77f91fbc6e73e58b5 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Thu, 27 Sep 2001 05:50:56 +0000 Subject: * doc/fileevent.n: Accepted [Patch #465279] adding an example to the fileevent manpage. Minor modifications to get a better formatting. Report and patch by David N. Welton . --- ChangeLog | 8 ++++++++ doc/fileevent.n | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0a3c241..ce7bb53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2001-09-26 Andreas Kupries + * doc/fileevent.n: Accepted [Patch #465279] adding an example to + the fileevent manpage. Minor modifications to get a better + formatting. Report and patch by David N. Welton + . + * The changes below fix [Bug #462317] where Expect tried to read more than was in the buffers and then blocked in the OS call as its pty channel driver provides no blockmodeproc through which @@ -7,6 +12,9 @@ the general I/O core has to take more care than usual to preserve the semantics of non-blocking channels. + The problem was reported by "Kevin O'Gorman" + . + * generic/tclIO.c (Tcl_ReadRaw): Do not read from the driver if the channel is non-blocking and the fileevent causing the read was generated by a timer. We do not know if there is data diff --git a/doc/fileevent.n b/doc/fileevent.n index 037d361..8e82564 100644 --- a/doc/fileevent.n +++ b/doc/fileevent.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: fileevent.n,v 1.4 2001/09/14 19:20:40 andreas_kupries Exp $ +'\" RCS: @(#) $Id: fileevent.n,v 1.5 2001/09/27 05:50:56 andreas_kupries Exp $ '\" .so man.macros .TH fileevent n 7.5 Tcl "Tcl Built-In Commands" @@ -101,6 +101,21 @@ In addition, the file event handler is deleted if it ever returns an error; this is done in order to prevent infinite loops due to buggy handlers. +.SH EXAMPLE +.PP +.CS + proc GetData {chan} { + if {![eof $chan]} { + puts [gets $chan] + } + } + + fileevent $chan readable [list GetData $chan] + +.CE +In this setup \fBGetData\fR will be called with the channel as an +argument whenever $chan becomes readable. + .SH CREDITS .PP \fBfileevent\fR is based on the \fBaddinput\fR command created -- cgit v0.12