Add file locking mechanism to make thread safe.
Add file locking mechanism to make thread safe.

Implement a FileLock mechanism that uses soft links to create a lock.
Create new OODictYamlLock class that uses FileLock and make User
class a subclass of OODictYamlLock.

Every call to lock_n_load locks db.yaml by creating a db.yaml.lock
soft link (atomic operation). If link (lock) already exists, call will
block up to a defined timeout after which it will break the lock.

Also, when saving, data is dumped to db.yaml.tmp file and then moved in
position (atomic operation) to avoid a thread reading halfwritten data.

afivos/mist.io,afivos/mist.io,DimensionDataCBUSydney/mist.io,DimensionDataCBUSydney/mist.io,Lao-liu/mist.io,Lao-liu/mist.io,zBMNForks/mist.io,munkiat/mist.io,DimensionDataCBUSydney/mist.io,munkiat/mist.io,kelonye/mist.io,johnnyWalnut/mist.io,Lao-liu/mist.io,munkiat/mist.io,afivos/mist.io,zBMNForks/mist.io,kelonye/mist.io,kelonye/mist.io,DimensionDataCBUSydney/mist.io,johnnyWalnut/mist.io,johnnyWalnut/mist.io,zBMNForks/mist.io,Lao-liu/mist.io,munkiat/mist.io