c# - Putting a thread to sleep for decimal value -
this question system.threading.thread.sleep(int)
. know there no method decimal value, need work decimals. here situation
i have device takes 20.37 milliseconds turn 1 degree. so, need put code sleep appropriate multiplication of 20.37 (2 degrees = 20.37*2 etc). since thread class got no decimal sleep method, how can this? please help!
that not work way. sleep
grant thread sats idle x time, not won't stay idle more. end of sleep period means thread available scheduler run it, scheduler may chose run other threads/processes @ moment.
get initial instant, find final instant, , calculate current turn time passed. also, not forget check how precise time functions are.
real-time programming has particularities in own advice seek more info in topic before trying work. can pretty extensive (multiprocessing os vs monoprocessing, priorities, etc.)
Comments
Post a Comment