Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::Sync Class Reference

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

#include <Sync.h>

Inheritance diagram for sf::Sync:

Classes

class  Lock
 Locks the Mutex object in the Sync object. More...
 

Protected Member Functions

 Sync ()=default
 Only multi inheritance is allowed to create this instance.
 
 Sync (const Sync &)
 Copy constructor does not copy the Mutex object, since the new object is not being used in any of its own member functions. This means that the new object must start in an unlocked state.
 
Syncoperator= (const Sync &)
 Does not copy the Mutex object, since the new object is not being used in any of its own member functions. This means that the new object must start in an unlocked state.
 

Detailed Description

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

Sync Public Interface

None. Sync can only be a base class.

Sync Protected Interface

Sync(const Sync&);
                        Copy constructor. Does not copy the Mutex object.

const Sync& operator =(const Sync&);
                        Assignment operator. Does not copy the Mutex object.

class Lock;            Handles locking and unlocking of member functions.

Example

class ThreadSafe : private Sync
{
public:
void f();
void g();
private:
int i;
};
void ThreadSafe::f()
{
Lock lock(this);
if (i == 2)
i = 3;
}
void ThreadSafe::g()
{
Lock lock(this);
if (i == 3)
i = 2;
}
Sync provides a system-independent interface to build classes that act like monitors,...
Definition Sync.h:57

Constructor & Destructor Documentation

◆ Sync() [1/2]

sf::Sync::Sync ( )
protecteddefault

Only multi inheritance is allowed to create this instance.

◆ Sync() [2/2]

sf::Sync::Sync ( const Sync )
inlineprotected

Copy constructor does not copy the Mutex object, since the new object is not being used in any of its own member functions. This means that the new object must start in an unlocked state.

Member Function Documentation

◆ operator=()

Sync & sf::Sync::operator= ( const Sync )
inlineprotected

Does not copy the Mutex object, since the new object is not being used in any of its own member functions. This means that the new object must start in an unlocked state.


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