ufo-kit/concert — pull request #263 by tomago (2014-05-31 10:06:10+00:00)
Title: Busy waiting

Since the devices don't play nicely the low-level implementations of setters use busy waiting to guarantee the blocking nature of setting a parameter. Our implementations until now used arbitrary waiting mechanisms which this PR tries to fix. There is a low-level `wait_until` function and then the parameters use this to `_wait` on some change on them. Then one can write:
```python
class FooMotor(LinearMotor):
...
def _set_position(self, position):
self._connection.send('Move it here: {}'.format(position))

# If the motor doesn't implement state-checking functionality
self['position']._wait(position, eps=FooMotor.POSITION_EPS)

# This is awkward but works
wait_until(lambda: self.check_state() == 'standby')
# If the state was a normal parameter it could be
self['state']._wait('standby')
```

Currently, the `_wait` is underscored because it is not supposed to be used by users and would just confuse them anyway. In any case, the `wait_until` is the most important thing here. Of course, the implementation is very trivial, but the point is that we hide the busy waiting from device implementers and can easily exchange it in the future for something more sophisticated.