[plt-scheme] scheme equivelent(?) to select(2)?
I think what you're looking for is "sync" (or one of its alternate
forms: "sync/timeout", "sync/enable-break",
"sync/timeout/enable-break").
Greg
On 6/10/06, Mike <mikee at mikee.ath.cx> wrote:
> On Sun, 11 Jun 2006, Jepri might have said:
>
> > Since mzscheme appears to support threads for every platform it runs on,
> > I tend to write network code that makes a thread for every port. Then
> > I use read in each thread and let the calls block. I'm not sure of
> > the best way to do it in one thread.
> >
> > Mike wrote:
> >
> > >I'm working on the tcp portion of my server monitor. I C at
> > >this point I would use select(2) to detect if any connections to
> > >servers had messages to read. In the manual under the TCP section
> > >I do see ways to 'peek' for bytes, but nothing that seems to be a
> > >select() call. I have my connections stored in a hash and am using
> > >(hash-table-for-each) to loop through the current connections. I
> > >guess what I really want is more of something like (read? p) that
> > >returns #t if there are bytes available for reading.
>
> Fascinating idea. I have used threads in other languages. In mzscheme
> I had not thought of using blocking threads for each of the monitored
> client connections. Do you have any problems synchronizing data across
> the multiple threads?
>
> Mike
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>