[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threading/Process Question



What's the best way of starting up multiple interpreter threads
that have relatively isolated namespaces?

For example, I might want a process A, B, and C, each sharing
the usual Scheme predefined global functions, etc.

But I would like it to be possible to define functions in A
that are not present in B.

My current stab at this looks something like this:

    // The following is executed once at program startup.
    Scheme_Env* env = scheme_basic_env();
    Scheme_Config* config = scheme_config;


    ... later ... (may be hit various times during a program run)

    // This code is used to create a new thread that might
    // be swapped to in the future.
    Scheme_Process* proc = scheme_thread(NULL, config);


    ... Still later, I want to get back to thread "A"
    scheme_swap_process(proc);


However, this doesn't work right -- it causes me to segfault
when I try to execute code after the scheme_swap_process.

Does "scheme_thread" return a real, usable Scheme_Process*,
or must I fill in part of the information elsewhere?

Thanks,

-Brent