usleep in uClibc - 0.9.27

Nitish Arya nitish at gisil.com
Tue Apr 25 09:46:08 UTC 2006


Hi Sonia,
  I am using same kernel and uClibc version, and usleep does work
correctly. You may try using timer_create(CLOCK_REALTIME), timer_settime
rather than setitimer as it seems to work fine and has a ns resolution.
Also, it is better to use a auto-reloading timer for such tasks than
using a thread, if the code to be executed is not very time-consuming,
otherwise, context switch when timer expires (sort of scheduler).
regards,
nitish

On Tue, 2006-04-25 at 10:42 +0200, Sonia wrote:
> Hi all,
> 
> I'm using uClinux 2.6.12 with uClibc - 0.9.27. I'm in
> the work of porting my application from kernel 2.4 to
> kernel 2.6. I'm using the toolchain
> m68k-elf-tools-20031003.sh
> 
> The application is multithreaded, and the threads are
> synchronized using usleep() to make the thread stops
> and let the other threads run.
> 
> With kernel 2.4 it worked fine, and we succeeded in
> giving priority to one "real - time" thread that had
> to send a message every 100 ms, using usleep.
> 
> The problem comes with kernel 2.6. It seems that
> usleep function doesn't work properly. If I put:
> 
> usleep(1000);
> 
> and look with an osciloscope (using leds or digital
> outputs on the board), I find out that the thread
> sleeps for 10 ms, not the expected 1 ms.
> 
> >From other hand, if I set up a timer, with
> setitimer(), if the period is 50 ms I get 70 ms.
> 
> Has somebody found the same behaviour??
> 
> Thanks in advance,
> 
> Best regards,
> 
> Sonia  
> 
>   
> 
> 
> 		
> ______________________________________________ 
> LLama Gratis a cualquier PC del Mundo. 
> Llamadas a fijos y móviles desde 1 céntimo por minuto. 
> http://es.voice.yahoo.com
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc




More information about the uClibc mailing list