SERVER-9934: Speed up failovers after an rs.stepDown()

With a healthy cluster, after an rs.stepDown(), the election for the
new primary normally completes within 1-2s. However, before the new
primary can step up, it has to stop the background sync thread.

Suppose (as is usually/often the case) that the new primary was
syncing from the stepped-down node. When that node stepped down, it
closed all connections, including the connection the new primary was
using to read the oplog. This triggered a DBException inside of
_producerThread, triggering this code:

    sethbmsg(str::stream() << "db exception in producer: " << e.toString());
    sleepsecs(10);

When the new primary goes to stop the rsBackgroundSync thread, the
thread is caught in the middle of that sleep, and so we end up
literally waiting on a sleep(10) before the cluster has a new primary.

In the interests of a minimally-disruptive fix, just replace the sleep
with a timed wait on a condvar, checking whether we are trying to
assume the primary role, and exiting if so. And as long as we have
that abstraction, replace a few other sleepsec()s with it.

In my testing (https://gist.github.com/nelhage/5777797), this reduces
the post-stepdown failover time on a completely unloaded cluster
running on localhost from 10-12s to about 4s, quite consistently.