aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/default/textures/player.png
diff options
context:
space:
mode:
authorMarkuBu <markus.burrer@gmail.com>2017-04-01 16:50:53 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-01 16:50:53 +0200
commit26f4a5c2d1e3d825816188fcd63f6d1f6758ae60 (patch)
treef7a0c054309e7ba547cac27d919a8c04b667f594 /games/minimal/mods/default/textures/player.png
parentef56586ed32ca67bd0ae4bbd474f3eca2ce56ec5 (diff)
downloadminetest-26f4a5c2d1e3d825816188fcd63f6d1f6758ae60.tar.gz
minetest-26f4a5c2d1e3d825816188fcd63f6d1f6758ae60.tar.bz2
minetest-26f4a5c2d1e3d825816188fcd63f6d1f6758ae60.zip
First commit for fine pointed (#5485)
Diffstat (limited to 'games/minimal/mods/default/textures/player.png')
0 files changed, 0 insertions, 0 deletions
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "threading/event.h" Event::Event() { #ifndef USE_CPP11_MUTEX # if USE_WIN_MUTEX event = CreateEvent(NULL, false, false, NULL); # else pthread_cond_init(&cv, NULL); pthread_mutex_init(&mutex, NULL); notified = false; # endif #endif } #ifndef USE_CPP11_MUTEX Event::~Event() { #if USE_WIN_MUTEX CloseHandle(event); #else pthread_cond_destroy(&cv); pthread_mutex_destroy(&mutex); #endif } #endif void Event::wait() { #if USE_CPP11_MUTEX MutexAutoLock lock(mutex); while (!notified) { cv.wait(lock); } notified = false; #elif USE_WIN_MUTEX WaitForSingleObject(event, INFINITE); #else pthread_mutex_lock(&mutex); while (!notified) { pthread_cond_wait(&cv, &mutex); } notified = false; pthread_mutex_unlock(&mutex); #endif } void Event::signal() { #if USE_CPP11_MUTEX MutexAutoLock lock(mutex); notified = true; cv.notify_one(); #elif USE_WIN_MUTEX SetEvent(event); #else pthread_mutex_lock(&mutex); notified = true; pthread_cond_signal(&cv); pthread_mutex_unlock(&mutex); #endif }