From 8dc54fa3e0120b8916399d8eb7c07c8dbf3810cb Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 28 May 2014 18:49:02 +0000 Subject: Update comment to explain assumptions. --- generic/tclIO.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 911fa97..ccd5708 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -3655,9 +3655,16 @@ static int WillRead(Channel *chanPtr) if ((chanPtr->typePtr->seekProc != NULL) && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { - /* TODO: Consider when channel is nonblocking and this - * FlushChannel() call may not finish the task of shoving - * bytes out. Then what? */ + /* + * CAVEAT - The assumption here is that FlushChannel() will + * push out the bytes of any writes that are in progress. + * Since this is a seekable channel, we assume it is not one + * that can block and force bg flushing. Channels we know that + * can do that -- sockets, pipes -- are not seekable. If the + * assumption is wrong, more drastic measures may be required here + * like temporarily setting the channel into blocking mode. + */ + if (FlushChannel(NULL, chanPtr, 0) != 0) { return -1; } -- cgit v0.12