cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
3,497 Views
Registered: ‎07-28-2009

sleep functionality for micro-second granularity?

I'm using xilkernal 4.00.a - and I'm looking for a method to perform a sleep within threads that have microsecond granularity. The threads in question are a mix of threads created statically (started at xilkernel start time) and dynamic (started using pthread_create() by a statically created thread

 

Currrent sleep() is only good to 1ms.

 

usleep() is a delay spin-loop and does not free up the processor.

 

Are any lower level APIs or system calls available?

 

Thanks.

0 Kudos
1 Reply
Highlighted
Xilinx Employee
Xilinx Employee
3,484 Views
Registered: ‎04-23-2008

Re: sleep functionality for micro-second granularity?

The scheduler runs with the timer interrupt.  A 1us timer tick isn't going to be practical.  If you simply want to force the scheduler to run, call yield -- I doub't your thread could be rescheduled in much less than 1us even if there is nothing else going on.  If your application requires that the scheduler run in some specific way at some specific instant, you should reconsider your software design.  Otherwise, a very small spin-loop delay isn't necessarily a terrible thing (and you can specifically yield in the loop if need be).

 

-Brian

0 Kudos