29#ifndef GENAPI_GCSYNCH_H
30#define GENAPI_GCSYNCH_H
38#elif defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__))
39# include <semaphore.h>
47# error No/unknown platform thread support
50namespace GENICAM_NAMESPACE
90 CRITICAL_SECTION m_csObject;
91#elif defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__))
93 pthread_mutex_t m_mtxObject;
97# error No/unknown platform thread support
113 int64_t GetLockCount();
116 int64_t GetRecursionCount();
118# elif defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__) || defined(VXWORKS))
121# error No/unknown platform support
141 AutoLock(
CLock& lock)
153 AutoLock& operator=(
const AutoLock&);
154 AutoLock(
const AutoLock&);
166 template<
class Object>
170 mutable CLock m_Lock;
185 m_Object.m_Lock.
Lock();
198 return Lock( *
this );
215#if defined(_WIN32) && ! defined(PHARLAP_WIN32)
235 bool Lock(
unsigned int timeout_ms);
243#if defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__))
251#elif defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__))
258# error No/unknown platform thread support
264 mutable long m_DebugCount;
Standard GenICam Exceptions.
Platform-dependent type definitions.
unlocks the global lock object on destruction
Definition GCSynch.h:287
void UnlockEarly(void)
This function allows to unlock the object early before the object is destroyed.
Definition GCSynch.h:306
Named global lock which can be used over process boundaries.
Definition GCSynch.h:208
void Unlock(void)
leaves the lock
bool Lock(unsigned int timeout_ms)
enters the lock (may block)
bool IsValid(void) const
tests whether the lock is valid
bool TryLock(void)
tries to enter the lock and returns immediately when not possible
CGlobalLock(const GENICAM_NAMESPACE::gcstring &strName)
CGlobalLock(const char *pszName)
A lock class.
Definition GCSynch.h:62
bool TryLock()
tries to enter the critical section; returns true if successful
void Lock()
enters the critical section (may block)
void Unlock()
leaves the critical section
Instance-Lock for an object.
Definition GCSynch.h:168
Lock GetLock() const
Get a new lock.
Definition GCSynch.h:196
A string class which is a clone of std::string.
Definition GCString.h:51