SemaphoreImplWin32.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 //----------------------------------------------------------------------
00008 //----------------------------------------------------------------------
00009 #include "SemaphoreImplWin32.h"
00010 
00011 namespace icl_core {
00012 namespace logging {
00013 
00014 SemaphoreImplWin32::SemaphoreImplWin32(size_t initial_value)
00015   : m_semaphore(NULL)
00016 {
00017   m_semaphore = CreateSemaphore(NULL, LONG(initial_value), LONG_MAX, NULL);
00018 }
00019 
00020 SemaphoreImplWin32::~SemaphoreImplWin32()
00021 {
00022   CloseHandle(m_semaphore);
00023 }
00024 
00025 void SemaphoreImplWin32::post()
00026 {
00027   ReleaseSemaphore(m_semaphore, 1, NULL);
00028 }
00029 
00030 bool SemaphoreImplWin32::wait()
00031 {
00032   DWORD res = WaitForSingleObject(m_semaphore, INFINITE);
00033   return res == WAIT_OBJECT_0;
00034 }
00035 
00036 }
00037 }


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19