OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TSync Class Reference

TSync 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. More...

#include <owl/thread.h>

Classes

class  TLock
 This nested class handles locking and unlocking critical sections. More...

Protected Types

typedef TLock Lock
 For compatibility with old T-less typename.

Protected Member Functions

 TSync ()
 Default constructor.
 TSync (const TSync &)
 Copy constructor does not copy the TCriticalSection object, since the new object is not being used in any of its own member functions.
const TSync & operator= (const TSync &)
 Does not copy the TCriticalSection object, since the new object is not being used in any of its own member functions.

Friends

class TLock

Detailed Description

TSync 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.

TSync uses TCriticalSection, so it is portable to all platforms that TCriticalSection has been ported to.

Example

class ThreadSafe : private TSync
{
public:
void f();
void g();
private:
int i;
};
void ThreadSafe::f()
{
TLock lock(this);
if (i == 2)
i = 3;
}
void ThreadSafe::g()
{
TLock lock(this);
if (i == 3)
i = 2;
}
TSync()
Default constructor.
Definition thread.h:1299
friend class TLock
Definition thread.h:450

Definition at line 435 of file thread.h.

Member Typedef Documentation

◆ Lock

typedef TLock owl::TSync::Lock
protected

For compatibility with old T-less typename.

Definition at line 451 of file thread.h.

Constructor & Destructor Documentation

◆ TSync() [1/2]

owl::TSync::TSync ( )
inlineprotected

Default constructor.

Definition at line 1299 of file thread.h.

◆ TSync() [2/2]

owl::TSync::TSync ( const TSync & )
inlineprotected

Copy constructor does not copy the TCriticalSection 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.

Definition at line 1309 of file thread.h.

References TSync().

Member Function Documentation

◆ operator=()

const TSync & owl::TSync::operator= ( const TSync & )
inlineprotected

Does not copy the TCriticalSection 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.

Definition at line 1318 of file thread.h.

References TSync().

◆ TLock

friend class TLock
friend

Definition at line 450 of file thread.h.


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