[GRASS-dev] g.mapsets use of sleep()
Moritz Lennert
mlennert at club.worldonline.be
Fri May 18 07:58:22 EDT 2007
On 16/05/07 22:58, Markus Neteler wrote:
> [ MinGW compile errors for sleep() ]
>
>
> Glynn Clements wrote:
>> ...
>> ... use G_sleep() instead:
>>
>> >From lib/gis/sleep.c:
>>
>> unsigned int G_sleep (unsigned int seconds)
>> {
>> #ifdef __MINGW32__
>> /* TODO: no sleep for now */
>> return 0;
>> #else /* __MINGW32__ */
>> return sleep(seconds);
>> #endif /* __MINGW32__ */
>> }
>>
>> On MinGW, it doesn't actually sleep, but at least you don't get a link
>> error.
>>
>
> I have added there code for MinGW to use Sleep() and updated
> all remaining sleep() to G_sleep().
The implementation you used does not work:
#ifdef __MINGW32__
return Sleep((seconds)*1000);
#else
The problem is that Sleep is void and thus does not give a value you can
return (http://msdn2.microsoft.com/en-us/library/ms686298.aspx).
We need something like this:
#ifdef __MINGW32__
Sleep((seconds)*1000);
return 0;
#else
Just not sure: is 0 the correct value to return ? IIUC this is the value
returned by the unistd.h version of sleep.
Moritz
More information about the grass-dev
mailing list