Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9d2f44216528bf54640655eeaabf0e0df150e0b9
Ticket: 636161ffffffffffffffffffffffffffffffffff
Tcl_FS* problems on windows&threads
User & Date: zoro2 on 2002-11-11 05:41:58
Changes

  1. icomment:
    Logged In: YES 
    user_id=191529
    
    I digged a bit more and found out that this problem occured
    with the vfs package - which is used in TclKit to load
    itcl.tcl and other modules.
    
    The problem is weird, and probably not vfs module related,
    since it only happens in Tcl_FSEvalFile and only on Windows
    - using Tcl's open/read/close does not cause any errors at
    all. It probably sets refCount wrong somewhere in either vfs
    or Tcl module.
    
    A good workaround is to rewrite source to use
    open/read/close for each thread:
    
    proc ::source {file} {
        if {[catch {set fh [open $file r]; set body [read $fh];
    close $fh} rc]} {
            return -code error -errorinfo $rc -errorcode
    $::errorCode $rc
        }
        set s [info script]
        info script $file
        if {[catch {uplevel 1 $body} rc]==1} {
            info script $s
            catch {thread::send -async $threadpool::mainthread
    [list puts $::errorInfo]}
            return -code error -errorinfo $rc -errorcode
    $::errorCode $rc
        }
        info script $s
        return $rc
    }
    
    This code slows things down a bit, but it does not require
    any patches to the core and may prove useful until a real
    solution is found.
    
    
  2. login: "zoro2"
  3. mimetype: "text/plain"
  4. priority changed to: "2"
  5. username: "zoro2"