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

Re: Threading/Process Question



On Wed, Nov 22, 2000 at 07:43:24PM -0800, Matthew Flatt wrote:
> Instead, create a new one:
> 
>   scheme_thread(thunk, scheme_make_config(scheme_config));
> 
> [Note: the docs claim that NULL is a legal second argument to
> scheme_thread(), but it isn't anymore.]
> 

One final problem:

I am actually making use of the exception-catching thunk code
form the Inside MzScheme document.

In that code, I pass a text string that is my Scheme code to
be evaluated:

value = _apply_thunk_catch_exceptions(scheme_make_closed_prim(do_eval,
           (char*)cmd), &exn);

Which in turn calls evals internally:

v = _scheme_apply(exn_catchin_apply, 1, &f);

Where in this chain of calls is it best to do the thread switching?
I was trying to do it outside of this region entirely to keep things
simple, but since I must pass the thunk directly to the thread
I guess this must be done within exn_catching_apply:

exn_catching_apply = scheme_eval_string(e, env);

where:

char* e = 
    "(#%lambda (thunk)
          (#%with-handlers ([#%void (#%lambda (exn) (#%cons #f exn))])
	  (#%cons #t (thunk))))"

Any suggestions?  Could it be a simple as just passing MzScheme
a dummy "(+ 1 2)" thunk earlier to create the thread, and leave
the rest as-is?

Thanks,

-Brent