Forum OpenACS Q&A: Response to Halting a thread for a specified time

Collapse
Posted by Andrew Piskorski on
E.g., put something along these lines in mypackage-init.tcl:

if { ![nsv_exists . shutdown_pending] } { 
   nsv_set . shutdown_pending 0 
   ns_atshutdown [list nsv_set . shutdown_pending 1] 
}

Then in your detached thread do something like:

while { ![nsv_get . shutdown_pending] } { 
   ns_sleep 60 
   # Etc. 
}