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

Re: [MiNT] nanosleep



On Mon, 21 Jan 2013 16:44:59 , Eero Tamminen <oak@helsinkinet.fi> wrote:
> Hi,
>
> On maanantai 21 tammikuu 2013, Peter Slegg wrote:
> > I suspect my mintlib might be too old to include nanosleep.
> > Is there some way of checking ?
>
> nm /usr/lib/libc.a ¦ grep sleep
>
> The one marked with "T" is the real implementation, others
> are references to that.
>
> My MiNTlib from Sparemint (= v0.59.1) doesn't seem to contain
> nanosleep(), just usleep().
>
> But why nanosleep() is needed, isn't usleep() microsecond
> accuracy enough? [1]
>
> nanosleep() is POSIX 2001, usleep() is BSD function.
>
>
> [1] On a pre-emptive multitasking OS, process gets
> pre-empted at arbitrary times and busy other processes
> can lenghten the sleep at max by:
>     <number of busy processes> * <scheduling slice>
>
> Even with just one, busy process it's milliseconds,
> not microseconds.
>
>
>     - Eero


Some years ago I wrote a small cli app that read data over the serial
port from a Suunto dive computer via an adapter.

I have changed Suunto and I am trying to re-write it. The protocol is
more complex. I did find mosquito tools that does the same thing but
I can't get it to compile so I was just planning to modify mine.

I will try usleep instead.

Is anyone planning to rpm the newest mintlib ?

Regards,

Peter