Link to home
Start Free TrialLog in
Avatar of BlackRussian
BlackRussian

asked on

how to schedule threads for time

Hi I'm using pthreads. I've have not been able to find a examples showing how to schedule thread execution based on time. For example if i want a thread to run every 100ms. Can anyone point me to some good example code.
Avatar of ravenpl
ravenpl
Flag of Poland image

It's in fact impossible under linux. Linux does not guarantee You any timings.
What You need is real time scheduling - try http://www.tldp.org/HOWTO/RTLinux-HOWTO.html

Or maybe You just need to do something, then sleep for about 100ms, then do something else and so on?
You could make one of threads a scheduler, which would trigger other threads(mutex, waitqueue, etc.) at given time points...
ASKER CERTIFIED SOLUTION
Avatar of brettmjohnson
brettmjohnson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
excuse me - You haven'k know the usleep() function?
Maybe You should then ask - how to sleep for 100ms....