[plt-scheme] capturing output from different threads

From: Dave Griffiths (dave at pawfal.org)
Date: Wed Mar 5 05:53:33 EST 2008

Hi all,

I've been capturing the output from an embedded interpreter like so:

outport = scheme_make_byte_string_output_port();
errport = scheme_make_byte_string_output_port();
scheme_set_param(scheme_current_config(), MZCONFIG_OUTPUT_PORT, outport);
scheme_set_param(scheme_current_config(), MZCONFIG_ERROR_PORT, errport);

...
scheme_eval_string_all(...)
...

outmsg=scheme_get_sized_byte_string_output(outport,&size);
errmsg=scheme_get_sized_byte_string_output(errport,&size);

But this seems to crash the garbage collector elsewhere when I spawn a plt
thread in my script. Reading the docs it seems that scheme_set_param only
works for one thread, so I can imagine it would only work for the main
thread, so 1) is there a way to get new threads to inherit the main
thread's parameters and 2) will it also make the garbage collector happy?
;)

Also maybe related, I find that calling scheme_eval_string_all on the
interpreter causes all threads to get run, calling scheme_check_threads
doesnt seem to make any difference.

I'm still on 372 btw - has this area changed with v4?

cheers,

dave



Posted on the users mailing list.