memcached: switch leader election implementation to a lock

We reuse our lock code to manage the leader election, a.k.a. eat our own
dog food.

This also fixes the issue that all lock were not released when stop()
was called.

Change-Id: Ibbec3e8ac29d55247ec3b1b8941d5a9569b67677
Merge "memcached: switch leader election implementation to a lock"