Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 026a0ae8f8ba17609fae32b4315272cadb2d758f
Ticket: 027ba061a8aac869441267c2aef4c4bf9c705c10
Standard channels do not exist on new threads on Windows
User & Date: anonymous on 2014-09-30 14:10:44
Changes

  1. icomment:
    The behaviour can be replicated interactively and non-interactively, see my comment on 2014-09-26 06:28:17. The procedure: paste the code (which I include at the end of this message) in file "t.tcl", then run with "wish86.exe t.tcl".
    
    * * *
    
    So, the issue is three-fold:
     - On one hand there is a fundamental inconsistency between platforms (there is no std* on Windows). Not an issue, except for:
     - Tk emulates std* interactively *and non-interactively* (the latter not intended), but only on the first thread.
     - Tcl assumes the first three channels are special (the channel names even appear as "stdin", etc. when debugging). This causes issues such as those described in ticket 7d83d2193d6da63f5ba269bb9e3132074ef8212c.
    
    The latter two points seem to me bugs in Tk and Tcl respectively, and need action to be taken. In my view, either of the following seem reasonable: a) Tk does not create any channel at all on Windows (as presumed) and Tcl does not treat first three created channels as special, or b) Tk always creates three channels (although dummy) and Tcl can keep its assumptions. The latter is probably the most platform-consistent, although there might be drawbacks I am missing ATM.
    
    Thank you all,
    Adrián.
    
    ~~~
    package require Thread;
    set tid [::thread::create { ::thread::wait; }];
    ::pack [::ttk::label .l[incr i] -text "Patchlevel: $::tcl_patchLevel"];
    ::pack [::ttk::label .l[incr i] -text "Platform: [array get ::tcl_platform]"];
    ::pack [::ttk::label .l[incr i] -text "Main thread chans: [::chan names]"];
    ::pack [::ttk::label .l[incr i] -text "Other thread chan names: [::thread::send $tid { ::chan names; }]"];
    ::pack [::ttk::label .l[incr i] -text "Other thread file chans: [::thread::send $tid { ::file channels; }]"];
    ~~~
    
  2. login: "anonymous"
  3. mimetype: "text/plain"