Merge pull request #104 from trevorbernard/master

Backport fix for race condition on shutdown
Remove volatile memory barrier from starting

You don't need a memory barrier on starting since it's already guarded
by slot_sync.
Use try/finally style for opt_sync

This ensures that no matter what happens during the time the lock is
head, it will eventually be unlocked
Move tid into the scope of the try finally block