#!/usr/bin/tclsh

interp create foo
foo eval {
    load ./libonexit1.0.so
    package require Thread

    set tid [thread::create]
    thread::send -async $tid {set foo 42} result
    vwait result
    thread::release $tid

    puts $result
}

after 500 {
    interp delete foo
    exit
}

vwait forever

