[GRASS-dev] Re: [GRASS-user] [bug #3087] (grass) high cpu usage on mouse ops

Glynn Clements glynn at gclements.plus.com
Fri Jun 23 05:07:40 EDT 2006


Markus Neteler wrote:

> >>This bug's URL:
> >>http://intevation.de/rt/webrt?serial_num=3087
> >>
> >>The bug seems to be fixed for me. Anybody minds closing it?
> >>    
> >>
> >
> >
> >The bug still exists in v.digit only, e.g. when you open the "settings"
> >form.
> >
> >also I think it will turn up on systems that don't have nanosleep(), ie
> >systems that are not POSIX.1b (formerly POSIX.4) compliant. I have no
> >idea which if any systems won't be.
> >  
> >
> 
> GDAL does in configure.in:
>   dnl Needed on Solaris.
>   AC_CHECK_LIB(rt,nanosleep,,,)
> 
> while GRASS does:
>   AC_CHECK_FUNCS(nanosleep)
> 
> Does the difference matter?

The former checks whether nanosleep() is available when linking
against librt, while the latter checks whether it is available without
linking against additional libraries.

The former approach should only be used if the latter fails, so that
you don't link against librt if it isn't necessary.

One portable method to sleep for a fraction of a second is to use
select() with all descriptor sets NULL, e.g.:

           struct timeval tv;

           tv.tv_sec = 0;
           tv.tv_usec = 500000;

           retval = select(0, NULL, NULL, NULL, &tv);

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list