This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// From https://gist.github.com/ytsutano/4140432 by Yutaka Tsutano | |
// Modified by Yuri Tikhomirov | |
// (https://gist.github.com/yuri-tikhomirov/a81343dfd0eeaa4cc80a32aa095a2f5d) | |
// | |
// Refactored to support CRITICAL_SECTION usage on Windows, | |
// also made calls to lock() / try_lock() / unlock() inline. | |
// | |
// Performance tests: | |
// http://preshing.com/20111124/always-use-a-lightweight-mutex/ |