Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7f8d292f2a11b2aa2e6319dc06540811a8c2e6e184d37475e564792fd1a12bcd
Ticket: ddd71e92fbc0ef41b3fc61aa23b4b6c908a76ab9
External event loops cannot setup event sources
User & Date: anonymous on 2026-06-18 02:45:10
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    `Tcl_DoOneEvent` handles event sources are follows:
    
    - setup event sources by calling their `setupProc`
    - call `Tcl_WaitForEvent`
    - check event sources by calling their `checkProc`
    
    The `setupProc` of an event source may call `Tcl_CreateFileHandler` to request monitoring some file descriptor. Such a file descriptor then gets included by `Tcl_WaitForEvent` in the set of file descriptors to watch in the blocking call to `select`/`epoll`/`kqueue`.
    
    When replacing the notifier via `Tcl_SetNotifier`, instead of `Tcl_DoOneEvent` I run the external event loop, which will make a blocking call to `select`/`epoll`/`kqueue` similar to `Tcl_WaitForEvent`. However, I don't see a way to call `setupProc` on the event sources before making the blocking call, as the event sources are local to `tclNotify.c`.
    
    To process the event sources, I could call `Tcl_ServiceAll`, which runs
    
    - setup event sources by calling their `setupProc`
    - check event sources by calling their `checkProc`
    
    with no waiting step in between, effectively polling the event sources. But that still won't let me call `setupProc` before the blocking call and `checkProc` after the blocking call. As a result, the external event loop may get stuck on the blocking call if `setupProc` indeed creates a file handler for a file descriptor the external event loop is not aware about.
    
  5. foundin changed to: "8.6, 9.0"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Important"
  11. status changed to: "Open"
  12. submitter changed to: "anonymous"
  13. subsystem changed to: "01. Notifier"
  14. title changed to: "External event loops cannot setup event sources"
  15. type changed to: "Bug"