TMultiReadExclusiveWriteSynchronizer
[Properties (by Name)][Methods (by Name)][Events (by Name)]
Standard implementation of a IReadWriteSync interface
Declaration
Source position: systhrdh.inc line 40
Type
TMultiReadExclusiveWriteSynchronizer = class (TInterfacedObject, IReadWriteSync)
private
fThreadList : Array[0..15] of Pointer;
freaderqueue : peventstate;
fwritelock : TRtlCriticalSection;
fwaitingwriterlock : prtlevent;
fWriterThreadID : TThreadID;
fRevisionLevel : Cardinal;
fwriterequests : Cardinal;
factivethreads : Cardinal;
protected
function ThreadIDtoIndex(aThreadID: TThreadID) : Integer;
function GetThreadInfo(AutoCreate: Boolean) : Pointer;
procedure RemoveThread(AThreadInfo: Pointer);
public
constructor Create; Virtual;
destructor Destroy; Override;
function Beginwrite : Boolean;
procedure Endwrite;
procedure Beginread;
procedure Endread;
RevisionLevel : Cardinal;
WriterThreadID : TThreadID;
end
;
Description
TMultiReadExclusiveWriteSynchronizer is a default implementation of the IReadWriteSync interface. It uses a single mutex to protect access to the read/write resource, resulting in a single thread having access to the resource.
Members
Member | Type | Visibility | Description |
---|---|---|---|
Beginread | Method | public | Request read access to the resource |
Beginwrite | Method | public | Request write access to the resource. |
Create | Method | public | Create a new instance of the TMultiReadExclusiveWriteSynchronizer class |
Destroy | Method | public | Destroys the TMultiReadExclusiveWriteSynchronizer instance |
Endread | Method | public | Release read access to the resource |
Endwrite | Method | public | Release write access to the resource |
factivethreads | Field | private | |
freaderqueue | Field | private | |
fRevisionLevel | Field | private | |
fThreadList | Field | private | |
fwaitingwriterlock | Field | private | |
fwritelock | Field | private | |
fwriterequests | Field | private | |
fWriterThreadID | Field | private | |
GetThreadInfo | Method | protected | |
RemoveThread | Method | protected | |
RevisionLevel | Property | public | |
ThreadIDtoIndex | Method | protected | |
WriterThreadID | Property | public |
Inheritance
Class | Description |
---|---|
TMultiReadExclusiveWriteSynchronizer(IReadWriteSync) | Standard implementation of a IReadWriteSync interface |
See also
Name | Description |
---|---|
Cardinal | An unsigned 32-bits integer. |
Cardinal | An unsigned 32-bits integer. |
Cardinal | An unsigned 32-bits integer. |
Cardinal | An unsigned 32-bits integer. |
IReadWriteSync | Read/Write synchronizer |
peventstate | Pointer to EventState, which is an opaque type. |
prtlevent | Pointer to RTLEvent, which is an opaque type. |
TRtlCriticalSection | A critical section. |
TThreadID | Type for Thread-IDs |
TThreadID | Type for Thread-IDs |