roxen.lists.pike.general

Subject Author Date
Re: master and resolver Martin Stjernholm <mast[at]lysator[dot]liu[dot]se> 23-12-2008
Bill Welliver <<hww3[at]riverweb.com>> wrote:

> I'd like to be able to define multiple class resolvers for a single
> process (similar to what is possible in Java). For example, I'd like
> to be able to specify that a given thread uses a particular
> program/include/module path, and be able to keep them from being aware
> of modules and programs that might be in use in other threads.

There's a bunch of functions in the master that gets called during
compilation: get_default_module, resolv, handle_include, and
handle_inherit to name a few. The tricky thing is that all those calls
simply goes through master()->..., so I guess you have two options:

One is to disable threads, use replace_master, compile and then
restore (compile() disables threads internally anyway, so that's not
much of a difference).

The other is to use multiplexing resolv() etc. You could look at the
handler argument, since that gets passed through to most of those
functions (but I'm not entirely sure it's always passed). A variant on
this is to store your local master in a thread local variable. That's
more reliable.

So it's a bit messy anyway you do it. Grubbas new CompilerEnvironment
stuff might also be an option, but I'm not familiar with that.