fixed usage of boost condition variables in replication #642

Switched from boost::condition (which is just
boost::condition_variable_any) to get compile-time checking that we're
passing the right thing in to boost::condition_variable::wait.  There was
one case where we were passing in a mutex instead of a unique_lock
instance, and that mutex was unlocked, which is a violation of the
condition variable api.