From: <no...@so...> - 2002-12-13 13:51:56
|
Bugs item #653218, was opened at 2002-12-13 06:54 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=653218&group_id=10894 Category: 24. Channel System Group: 8.4.1 Status: Open Resolution: None Priority: 5 Submitted By: Rolf Schroedter (schroedter) Assigned to: Andreas Kupries (andreas_kupries) Summary: Channels CloseProc() not called on close Initial Comment: If there is pending BG output for a non-blocking channel then Tcl_DriverCloseProc() is not called when the 'close' command is invoked. That can be seen from generic/tclIO.c : Tcl_Unregister_Channel(): if (!(statePtr->flags & BG_FLUSH_SCHEDULED)) { ... This can be very bad if channel's output is stalled, e.g. a serial port blocked by handshake: % puts "Tcl $tcl_patchLevel" Tcl 8.4b1 % set chan [open com1: r+] fileaaf550 % fconfigure $chan -buffering none -blocking 0 % fconfigure $chan -mode 1200,n,8,1 -handshake rtscts % ### 2 outputs: "hello world" \x0D\x0A, BG_FLUSH % puts $chan "hello world" % puts "Queue: [fconfigure $chan -queue]" Queue: 0 13 % after 1000 % puts "Queue: [fconfigure $chan -queue]" Queue: 0 13 % close $chan % set chan [open com1: r+] couldn't open "com1:": permission denied % This problem occurs also for slow output without handshake: % puts "Tcl $tcl_patchLevel" Tcl 8.4b1 % set chan [open com1: r+] fileaaf768 % fconfigure $chan -buffering none -blocking 0 % # Explicitely reset handshake=none % fconfigure $chan -mode 1200,n,8,1 -handshake none % puts $chan "hello world" % puts $chan "hello world" % close $chan % set chan [open com1: r+] couldn't open "com1:": permission denied For Tcl < 8.4. this has never been observed for serial ports, because serial output has already been blocking. ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2002-12-13 08:51 Message: Logged In: YES user_id=80530 Is this related to FR 525783 ? ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2002-12-13 08:17 Message: Logged In: YES user_id=79902 When I have time (maybe, just maybe, over Xmas) I'll be advancing a TIP on behaviour-on-close of serial channels. ---------------------------------------------------------------------- Comment By: Rolf Schroedter (schroedter) Date: 2002-12-13 06:58 Message: Logged In: YES user_id=99573 This bahaviour may be interpretet not as a bug, but as a feature of the channel system. But then we need an additional option [fconfigure $chan -flushonclose 0] (default=1) for channels like serial ports. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=653218&group_id=10894 |