Implement MasterElection
Merge pull request #312 from AlCutter/election

Implement MasterElection
Add a util::Task class to manage async operations.
Add cancellation support to util::Task.
Add memory management to util::Task.