|
From: Jianshi H. <jia...@gm...> - 2012-05-03 02:16:46
|
On Mon, Apr 30, 2012 at 10:51 AM, Jianshi Huang <jia...@gm...> wrote: > >>> It would be nicer if we have *thread-exit-hooks* for each thread. >> >> Can you clarify this a bit? >> >> As a thread-local binding? Can do that, but don't quite see the point >> -- how would it be different from sticking an UNWIND-PROTECT clause to >> do the same? >> >> Or do you mean as a global variable, called per thread? I guess that >> makes sense, but don't see an immediate application. >> > > Yes, a global binding but also re-bound per thread. Unwind-protect is > ok, but having bindings means I can inherit same exit functions in new > threads (just rebind it, or use global binding). For convenience and > also the API seems more complete (process-scope hooks and thread-scope > hooks :) More clarification, I think the right configuration for the exit hook should be: 1) A global binding so that all threads can follow the same termination protocol 2) A thread local binding, so that I can do local changes to the exit hook 3) Threads spawned can be configured to inherit the thread local bindings, but the default settings should not do that Overkill? Any idea what level of convenience can we provide? What's your idea of the implementation? Cheers, -- 黄 澗石 (Jianshi Huang) http://huangjs.net/ |