|
In lugnet.robotics.rcx.legos, Ross Hennessy writes:
> Hi again,
>
> i would like to know which is more efficient in code? having a while loop
> which is checking for a condition to be true and sleeping for an arbitary value
> while it is not, or using a wait_event statement passing a function pointer to
> a method which checks for the same condition?
>
> thanks for all the help so far
>
> regards ross
There are two issues: 1 do you want to do anything while waiting, 2 how quick
do you want to respond to the event. In both cases using an event is better.
You can do something else until the event happens (synchronization issuses not
withstanding). With the sleep for a fixed period your response time will be the
full wait period, worst case and half the period on average whereas an event is
probably faster.
Lester
|
|
Message is in Reply To:
| | sleep efficientcy
|
| Hi again, i would like to know which is more efficient in code? having a while loop which is checking for a condition to be true and sleeping for an arbitary value while it is not, or using a wait_event statement passing a function pointer to a (...) (24 years ago, 25-Jan-01, to lugnet.robotics.rcx.legos)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|