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

Re: select/3 call equivalent in mzscheme



Quoting Noel Welsh:
> Recent experiences in Java, which has the same IO
> model as Scheme (give or take), has convinced me that
> non-blocking IO is useful. 

Yeah, sometimes you need to write your own scheduler. For example,
MzScheme's implementation would be far simpler if OSes provided
consistent support for non-blocking I/O. It hasn't escaped my attention
that MzScheme itself lacks such support! Perhaps in v200...

But, with respect to the original post, my guess is that Mike is
probably right. For most problems that I've encountered, threads are a
better solution than non-blocking I/O. Depends on the problem.

Quoting "Chris Wright":
> What's the best way to do a
> 
> select(if_list, of_list, exc_list, time_out)

If you really need select(), it can be implemented with threads and
break exceptions, but it's tricky and somewhat inefficient. (See
`semaphore-wait-multiple' in MzLib for the basic idea.)

Probably threads work better, but it depends on what you're trying to
accomplish. Care to share more details?

Matthew