Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 09c76b19535578599ffdb8a570c0d95a3884866b88186167a5401840ab137557
Ticket: b78d94c049af5090a9ef1c4aaa8059aa45b98b59
Thread pool panics if stdin closed and IO performed in initcmd
User & Date: sebres on 2025-02-22 13:17:02
Changes

  1. closedate changed to: "2460729.05350073"
  2. closer changed to: "sebres"
  3. icomment:
    It's not a bug, it's a documented feature...
    If the standard channels get closed, they will be reopen by next channel open command (chan/file/pipe/socket/whatever). 
    Just in your case the unexpected thing - you do that not from main thread (and the channel is opened not for read)...
    
    See [https://stackoverflow.com/a/68869664|https://stackoverflow.com/a/68869664] for more detailed answer to similar question.
    
    No idea what are you trying to do by closing of stdin, but if it is something like signal to caller EOF, you can simply reopen new (dummy) stdin implicitly after `close stdin`, for instance with `chan pipe` command.<br/>
    For instance, trying something like this in tcl-shell, you'd see that read side of pipe channels becomes (new) stdin:
    <code><pre>
        % close stdin; puts [chan pipe]
        stdin file3
    </pre></code>
    Hereafter everything shall work as expected with the threads (and registering channels doesn't get confused).
    
    By the way, this is Tcl- not thread-repository, so basically every thread-related stuff belongs to [../thread/|thread-repository].
    
  4. login: "sebres"
  5. mimetype: "text/x-fossil-wiki"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"