VAEventHandlerGlobalLock.h 1.52 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1
/*
2
 *  --------------------------------------------------------------------------------------------
Jonas Stienen's avatar
Jonas Stienen committed
3
 *
4 5 6
 *    VVV        VVV A           Virtual Acoustics (VA) | http://www.virtualacoustics.org
 *     VVV      VVV AAA          Licensed under the Apache License, Version 2.0
 *      VVV    VVV   AAA
7
 *       VVV  VVV     AAA        Copyright 2015-2018
8 9
 *        VVVVVV       AAA       Institute of Technical Acoustics (ITA)
 *         VVVV         AAA      RWTH Aachen University
Jonas Stienen's avatar
Jonas Stienen committed
10
 *
11
 *  --------------------------------------------------------------------------------------------
Jonas Stienen's avatar
Jonas Stienen committed
12 13
 */

14 15
#ifndef IW_VABASE_EVENT_HANDLER_GLOBAL_LOCK
#define IW_VABASE_EVENT_HANDLER_GLOBAL_LOCK
Jonas Stienen's avatar
Jonas Stienen committed
16 17 18 19 20

#include <VABaseDefinitions.h>

//! Global synchronization token for event handler operations
/**
21 22 23 24 25
  * This singleton class realizes a global synchronization token
  * that can be used to realize mutual exclusive operations regarding
  * event handlers, like attaching/detaching event handlers to
  * event handler registrys and destruction of event handlers.
  */
Jonas Stienen's avatar
Jonas Stienen committed
26 27 28 29
class VABASE_API IVAEventHandlerGlobalLock
{
public:
	//! Returns the singleton instance
30 31 32
	/**
	  * @return Global lock for event handling
	  */
Jonas Stienen's avatar
Jonas Stienen committed
33 34
	static IVAEventHandlerGlobalLock& GetInstance();

35
	//! Lock (blocking wait, no try)
36
	virtual void Lock() const = 0;
Jonas Stienen's avatar
Jonas Stienen committed
37

38
	//! Unlock
39
	virtual void Unlock() const = 0;
Jonas Stienen's avatar
Jonas Stienen committed
40 41

protected:
42
	//! Protected default constructor
Jonas Stienen's avatar
Jonas Stienen committed
43
	inline IVAEventHandlerGlobalLock() {};
44 45

	//! Protected destructor
Jonas Stienen's avatar
Jonas Stienen committed
46 47 48
	virtual inline ~IVAEventHandlerGlobalLock() {};
};

49
#endif // IW_VABASE_EVENT_HANDLER_GLOBAL_LOCK