[plt-scheme] capturing output from different threads

From: Dave Griffiths (dave at pawfal.org)
Date: Sat Mar 8 16:19:17 EST 2008

On Sat, 2008-03-08 at 13:17 -0700, Matthew Flatt wrote:
> At Sat, 08 Mar 2008 19:08:25 +0000, Dave Griffiths wrote:
> > One thing I've just noticed is that the output from the thread in that
> > example doesn't actually come through the outport - with this slightly
> > modified example, where I've prepended the output with "!!!" - any
> > ideas?:
> 
> I'm pretty sure that output does go through outport. If I comment out
> the C printf(), there's no output.
> 
> The thread will generate output much faster than it is extracted from
> the port. Maybe you're seeing a "!!!" followed by thousands of lines of
> "hello\n", so that the "!!!" is lost in the sea of output?
> 
> Also, scheme_get_sized_byte_string_output() doesn't remove the output
> from the port, so you're getting cumulative output every time.

Yes - of course! Sorry. Part of this is that I've been having trouble
reading the port with other calls. If I replace:

msg=scheme_get_sized_byte_string_output(outport,&size);

with:

size=scheme_get_byte_string("log",outport,msg,0,256,0,0,NULL);
(where msg is now an array of 256 bytes)

I just get -1 (EOF?) returned. The same for scheme_get_byte and friends
called on that port.

cheers,

dave




Posted on the users mailing list.