Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::TStaticSync< T > Class Template Reference

TStaticSync provides a system-independent interface to build sets of classes that act somewhat like monitors, i.e., classes in which only one member function can execute at any one time regardless of which instance it is being called on. TStaticSync uses Mutex, so it is portable to all platforms that Mutex has been ported to. More...

#include <TStaticSync.h>

Classes

class  Lock
 

Public Member Functions

TStaticSync< T > & operator= (const TStaticSync< T > &)=delete
 Do not allow copying.
 

Protected Member Functions

 TStaticSync ()
 Default constructor.
 
 TStaticSync (const TStaticSync< T > &)
 Copy constructor.
 
 ~TStaticSync ()
 Destructor.
 

Detailed Description

template<class T>
class sf::TStaticSync< T >

TStaticSync provides a system-independent interface to build sets of classes that act somewhat like monitors, i.e., classes in which only one member function can execute at any one time regardless of which instance it is being called on. TStaticSync uses Mutex, so it is portable to all platforms that Mutex has been ported to.

TStaticSync Public Interface

None. TStaticSync can only be a base class.

TStaticSync Protected Interface

TStaticSync<T>(const TStaticSync<T>&);
                        Copy constructor. Does not copy the Mutex object.

const TStaticSync<T>& operator =(const TStaticSync<T>&);
                        Assignment operator. Does not copy the Mutex object.

class Lock;            Handles locking and unlocking of member functions.

Example:

class ThreadSafe : private TStaticSync<ThreadSafe>
{
public:
void f();
void g();
private:
static int i;
};
void ThreadSafe::f()
{
TLock lock;
if (i == 2)
i = 3;
}
void ThreadSafe::g()
{
TLock lock;
if (i == 3)
i = 2;
}
TStaticSync provides a system-independent interface to build sets of classes that act somewhat like m...
Definition TStaticSync.h:59

Constructor & Destructor Documentation

◆ TStaticSync() [1/2]

template<class T >
sf::TStaticSync< T >::TStaticSync ( )
inlineprotected

Default constructor.

If this is the first TStaticSync<T> object to be constructed, create the semaphore.

The copy constructor only has to increment the count, since there will already be at least one TStaticSync<T> object, namely, the one being copied.

◆ TStaticSync() [2/2]

template<class T >
sf::TStaticSync< T >::TStaticSync ( const TStaticSync< T > &  )
inlineprotected

Copy constructor.

◆ ~TStaticSync()

template<class T >
sf::TStaticSync< T >::~TStaticSync ( )
inlineprotected

Destructor.

Member Function Documentation

◆ operator=()

template<class T >
TStaticSync< T > & sf::TStaticSync< T >::operator= ( const TStaticSync< T > &  )
delete

Do not allow copying.


The documentation for this class was generated from the following file: