Forum OpenACS Q&A: Re: finding nsd interpreter thread?

Collapse
Posted by Jonathan Ellis on
actually this particular piece is unchanged, so the threadname can be determined like this:
proc_doc ad_threadname {} {
    returns name of executing thread, e.g. -conn1-, -sched-, -nscp:nsadmin:1-, ...
} {
    foreach thread_info [ns_info threads] {
        set tid [lindex $thread_info 2]
        if {$tid == [ns_thread getid]} {
            return [lindex $thread_info 0]
        }
    }
    return "-unknown thread!?-"
}