On Sun, 15 Apr 2012, Yehuda Sadeh Weinraub wrote: > On Sun, Apr 15, 2012 at 9:44 PM, Sage Weil <sage@xxxxxxxxxxxx> wrote: > > We just switched the completion callbacks so that they are called > > asynchronously from another thread. This makes the locking less weird for > > certain callers and lets you call back into librados in your callback > > safely. > > > > This breaks one of the functional tests, which sets a bool in the > > callback, does wait_for_complete() on the aio handle, and then asserts > > that the bool is set. There's now a race between the caller's thread and > > the completion thread. > > > > Do we just call this a broken test, or do we want some way of blocking on > > the aio handle until the completion has been called? > > I'd expect wait_for_complete() to wait until the completion completed. > We can add some other wait_for_foo() for the current case. I pushed a wip-2301 that does this. The downside to this approach is that the is_safe() and is_complete() methods will return false until after the callback returns, which includes the callback itself. So a callback that assumes that is_complete() will return true will be wrong. If that's not okay, the alternative is to make the wait_for_complete() actually be a wait_for_complete_and_callback_has_returned(). That drops the symmetry between wait_for_complete() and is_complete(), which is awkward. sage