Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4d48467232546388b49b1910752a6745bb57be81
Ticket: 593810ffffffffffffffffffffffffffffffffff
Channel Transfer crashes
User & Date: zoro2 on 2002-11-09 04:49:23
Changes

  1. icomment:
    Logged In: YES 
    user_id=191529
    
    Workaround to the problem Andreas describes is unfortunately
    incomplete. Below is a testing script that SHOULD work. It
    stops when trying to do a gets on the channel, while when I
    use my *sockPtr=0 hack, everything seems to work OK.
    
    package require Thread
    set id [thread::create]
    thread::send $id {
        close [socket -server puts 0]
    }
    
    proc d {sock args} {
        after idle [list d0 $sock]
    }
    proc d0 {sock} {
        global id
        thread::send $id [list set sock $sock]
        thread::send $id [list set tid [thread::id]]
    
        thread::transfer $id $sock
    
        thread::send -async $id {
            puts $sock "HI"
            flush $sock
            thread::send -async $tid [list puts SENTHI]
            puts $sock [gets $sock]
            thread::send -async $tid [list puts SENTLINE]
            flush $sock
            close $sock
            thread::send -async $tid [list puts DONE]
        }
    }
    
    socket -server d 12345
    
    set next [thread::create]
    thread::send $next [list set tid [thread::id]]
    thread::send -async $next {
        package require Thread
        if {[catch {
            after 2000
            set s [socket 127.0.0.1 12345]
            puts $s TEST; flush $s
        } err]} {
            thread::send -async $::tid [list puts "ERROR:
    $::errorInfo"]
        }
    }
    
    
    
    
    
  2. login: "zoro2"
  3. mimetype: "text/plain"
  4. username: "zoro2"