[Top]
|
Method _disable_threads()
- Method
_disable_threads
_disable_threads _disable_threads()
- Description
This function first posts a notice to all threads that it is time
to stop. It then waits until all threads actually *have* stopped,
and then then returns a lock object. All other threads will be
blocked from running until that object has been freed/destroyed.
It's mainly useful to do things that require a temporary uid/gid
change, since on many OS the effective user and group applies to
all threads.
- Note
You should make sure that the returned object is freed even if
some kind of error is thrown. That means in practice that it
should only have references (direct or indirect) from function
local variables. Also, it shouldn't be referenced from cyclic
memory structures, since those are only destructed by the periodic
gc. (This advice applies to mutex locks in general, for that
matter.)
|