Well, for call_outs it can be done:
add_constant("call_out", my_backend->call_out); add_constant("_do_call_outs", my_backend->_do_call_outs); add_constant("find_call_out", my_backend->find_call_out); add_constant("remove_call_out", my_backend->remove_call_out); add_constant("call_out_info", my_backend->call_out_info);
(It will only affect code compiled after you run these lines of course.)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-01-23 05:54: Subject: Default backend and thread backends?
Hi,
Is there any way to _change_ default backend? Something like Pike.DefaultBackend->replace(MyBackend) - so all subsequent calls to call_out() and all file descriptors allocated after this will use new backend?
And more... It would be nice to have dedicated backends in some threads, so (say) all calls to call_out() and fd's allocation will use thread-specific backend (if it is set - and default otherwise). Something like Thread.Thread()->set_backend()...
All this functionality can be simulated(?) - like intercepting Stdio.File|Stdio.FILE object creation (to use Backend()->add_file()), call_out()s etc., but it wouldn't be as clean as "native" support (there is always chance to overlook something).
As to "Why?" - well, I simply don't want to (over)load single backend with callbacks from everywhere... Especially when I've SMP machine - it won't be used efficiently with single backend.
Any comments?
Regards, /Al
/ Brevbäraren