Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 78fe1ee9123bea1e087241ec4d46b40863260e24
Ticket: 35a839cba8a4e6bbdcd9567f958d56076fe5bd0f
Can not reinitialize Tcl after Tcl_Finalize()
User & Date: ferrieux on 2014-08-26 13:23:57
Changes

  1. icomment:
    I do confirm that the net result of the "Bug 2001201 exit reform" is to avoid calling Finalize in the normal exit path; but the reason is more subtle than "it's broken and I can't be bothered to fix it". Rather, it is the sum of two things:
    
     - exit() is really the fastest way of getting out, because it implies (a) bulk memory freeing (the mappings just disappear, without  crawling whatever the userland thinks its heap contains) and (b) bulletproof release of kernel resources (like fds, mutexes, etc). The OOP habit of recursively calling the Destructor of every single living form in the universe is a suboptimal way of exiting when there is no compulsory app-level cleanup to do.
    
     - multithread finalization can lead to deadlocks, and there is no way to avoid them with certainty, short of exit() itself.
    
    Note the "reform" only says that [exit] will shun Finalize() (unless the TCL_FINALIZE_ON_EXIT env var is set to 1); it says nothing about what embedders do. And it did not sabotage the Finalize() function itself ;)
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"