Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a1995b5dbe8d8b4fc6b1addb140c546c8a56894a
Ticket: 770053ffffffffffffffffffffffffffffffffff
Tcl_CreateThread breaks notifier thread refcount
User & Date: vasiljevic on 2003-07-12 08:30:50
Changes

  1. assignee changed to: "hobbs"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Tcl API is quite unsymetrical when creating threads 
    without embedded interpreter. 
    
    What hapenns is that when one uses Tcl_CreateThread
    API call to create new thread and Tcl_ExitThread to
    cleanup after itself when the thread exits, the notifier
    thread reference counter is decremented one time too
    much. This eventually tears-down the notifier thread
    and the inter-thread communication betwenn threads
    becomes impossible.
    If, however, a newly created thread calls the
    Tcl_CreateInterp, the reference count is ok.
    
    The problem lies in the fact that Tcl_CreateInterp
    calls, as part of its processing, Tcl_InitNotifier.
    This call bumps the refcount of the notifier thread.
    The Tcl_ExitThread calls Tcl_FinalizeNotifier and
    this decrements the refcount. In this case, all is ok.
    But, the Tcl_CreateThread *does not* call the 
    Tcl_InitNotifier, which then results in wrong refcount
    of the notifier thread when Tcl_ExitThread is called.
    
    I'm assigning this to Jeff since I do not know who
    is maintaining the thread API subsytem.
    
  4. foundin changed to: "obsolete: 8.4.3"
  5. priority changed to: "6"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "vasiljevic"
  9. subsystem changed to: "49. Threading"
  10. title changed to: "Tcl_CreateThread breaks notifier thread refcount"
  11. type changed to: "Bug"