Forum OpenACS Q&A: finding nsd interpreter thread?

Collapse
Posted by Jonathan Ellis on
How can I determine which thread my proc is running in?  e.g. conn0, sched, etc.  I thought either ns_conn or ns_thread would provide something like this, but apparently not...
Collapse
Posted by Brian Fenton on
Does nstelemetry.adp tell you anything useful?
Collapse
Posted by Jonathan Ellis on
it calls [ns_info threads] which would probably work if I could find the 3.5.1 docs anywhere...  it's changed from 3.3.1.
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!?-"
}