Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ca5a6b0b25aa715e278c8cdfc5cca236f60b5208
Ticket: 464340ffffffffffffffffffffffffffffffffff
thread::send might send to wrong interp
User & Date: vasiljevic on 2001-09-24 09:13:17
Changes

  1. assignee changed to: "vasiljevic"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Consider:
    
    set script {
       package require Thread
       set worker [thread::create {
         proc evaluate {cbThread script cbScript} {
           thread::send $cbThread\
             [list $cbScript [thread::id] [eval $script]]
         }
         thread::wait
       }]
       proc callback {thread value} {
         set ::continue {}
       }
       thread::send -async $worker \
           "evaluate [thread::id] list callback"
       vwait ::continue
       puts "$worker done"
    
    }
    
    set interp1 [interp create]
    $interp1 eval $script
    set interp2 [interp create]
    $interp2 eval $script
    
    The interp1 evaluation works fine. 
    The interp2 evaluation blocks indefinitely. 
    This is because the callback is executed in the
    wrong interpreter. The threading extension
    evaluates callbacks always in the main interpreter
    i.e. one which was active when the thread was started.
    
    Thanks for Jean-Luc Fontaine for pointing this out.
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "vasiljevic"
  9. subsystem changed to: "80. Thread Package"
  10. title changed to: "thread::send might send to wrong interp"
  11. type changed to: "Bug"