You are here

쓰레드 심플 예제

admin의 아바타
proc reader {payload} {
    puts $payload
}

set t1 [thread::create]
thread::send -async $t1 {
    proc produce {parentid} {
        while 1 {
            after 250   ;# substitutes for
            incr data   ;# the blocking read
            thread::send $parentid "reader $data"
        }
    }
}

set tid [thread::id]
thread::send -async $t1 [list produce $tid]

vwait forever

포럼: