Fixes for Max plugin compilation when not using PCH
Merge pull request #410 from zrax/pch_max_fixes

Fixes for Max plugin compilation when not using PCH
Use std::atomic_int for hsSafeRefCnt, and move it to hsRefCnt.h/cpp
Replace hsMutex with std::mutex
Replace hsSleep with std::thread::sleep_for
Use C++11 threading for hsEvent, and clean up the API a bit
Convert hsThread to a std::thread implementation
Simplify plDispatch mutexes a bit