chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] (file-select ...) and compiler warnings


From: Jim Ursetto
Subject: Re: [Chicken-users] (file-select ...) and compiler warnings
Date: Mon, 18 Feb 2013 14:36:33 -0600

On Feb 18, 2013, at 3:58 AM, J Altfas wrote:

> Certainly agree that leaving out usleep was an oversight, considering how 
> simple it is to include it. While I'm pretty sure many of the posix functions 
> are not optimum in an srfi-18 threaded environment, file-select, sleep, and 
> friends are still part of Chicken for good reasons. In that sense, I don't 
> think thread-sleep! would be a universal drop-in replacement for posix 
> usleep, et. al. 

It's probably not an oversight, just that as Felix said there was probably no 
usleep(3) in Windows and the equivalent was never implemented.  Also since 
file-select works, there was probably no impetus to fix it.

I would be ok with adding usleep to the posix-extras egg if you want.  I'm not 
sure if it should be a separate function or just override (sleep) to accept 
fractional values.  I'm thinking the latter.  I would ideally want to get it to 
work on Windows, maybe using John Cowan's suggestion (which gives at most 
millisecond precision, so "usleep" is not a good name) or 
QueryPerformanceCounter (?).  By the way, on Windows, (sleep t) is currently 
implemented as Sleep(t*1000), but the argument is artificially constrained to 
be an integer.

If you just want a direct interface to usleep, I would honestly just wrap it in 
a foreign-lambda in your code as you suggested.  I don't think it's a bad 
approach.

> As long as file-select is available in Chicken, people are going to have uses 
> for it. As it is, the current types.db declaration for file-select produces 
> several warnings. I was a little concerned the warnings might be distressing 
> for new Chicken users, though more a matter of technical details than truly 
> having dire consequences for the compiled output. 

Yes, erroneous warnings should definitely be fixed.  I didn't intend to address 
that in my reply.  file-select is actually a reasonable solution if you want a 
blocking sub-second sleep, although it too doesn't work on Windows.

Jim


reply via email to

[Prev in Thread] Current Thread [Next in Thread]