Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 437a60c10163e24fc9c0bd79c133833bbc8b5537
Ticket: 723502ffffffffffffffffffffffffffffffffff
Directory Read Bug w/TCL_THREADS
User & Date: vasiljevic on 2003-05-12 15:32:28
Changes

  1. icomment:
    Logged In: YES 
    user_id=95086
    
    Well, the readdir_r is supposed to be thread-safe, but 
    on osx, when many threads are doing: 
     
      opendir 
      readdir_r 
      closedir 
     
    in parallel, you get memory corruption in closedir 
    after a while.  
    What I did was wrap all those with my own wrappers 
    with my_opendir doing the actual opendir, slurping 
    all dir entries in an linked list with readdir_r and 
    my_readdir simply traversing this list. The my_closedir 
    frees the whole thing. All work of my_opendir is done 
    under mutex protection. This was the only way I could 
    solve the memory-trashing, which happens otherwise. 
     
    I'm not sure you can plug this into Tcl current layout 
    easily. That's why I suggest to wait for Apple to catch 
    up and update the OS and correct the bug. 
     
    No; I haven't posted a bug to Apple yet. Somehow I have 
    a very bad feeling about that (i.e. waste of time) judging 
    from my own previous experiences with the company.  
    But I may be wrong and things may have changed since... 
     
    Zoran 
     
    
    
  2. login: "vasiljevic"
  3. mimetype: "text/plain"
  4. username: "vasiljevic"