69 |
|
Note that the Linux semaphore set is also created with the shared memory. |
70 |
|
} |
71 |
|
|
72 |
< |
ISharedMemoryExt = interface(ISharedMemory) |
73 |
< |
['{7449e122-61c0-4ea9-acf4-f0a420af14aa}'] |
72 |
> |
ISharedMemory = interface |
73 |
> |
['{db77bdd4-233a-4c9c-9212-dd7945e2e57c}'] |
74 |
|
function IsInitialiser: boolean; |
75 |
+ |
function Allocate(Size: integer): PByte; |
76 |
+ |
function GetLastAllocationSize: integer; |
77 |
+ |
property LastAllocationSize: integer read GetLastAllocationSize; |
78 |
|
end; |
79 |
|
|
80 |
|
TSharedMemory = class(TIpcCommon,ISharedMemory) |
142 |
|
|
143 |
|
TSingleLockGate = class(TIpcCommon,ISingleLockGate) |
144 |
|
private |
145 |
< |
FSharedMemory: ISharedMemoryExt; |
145 |
> |
FSharedMemory: ISharedMemory; |
146 |
|
FSemaphore: cint; |
147 |
|
FMutex: cint; |
148 |
|
FSignalledState: PInteger; |
149 |
|
FWaitingThreads: PInteger; |
150 |
|
function GetWaitingThreads: integer; |
151 |
|
public |
152 |
< |
constructor Create(SemNum: cint; sm: ISharedMemoryExt); |
152 |
> |
constructor Create(SemNum: cint; sm: ISharedMemory); |
153 |
|
property WaitingThreads: integer read GetWaitingThreads; |
154 |
|
public |
155 |
|
procedure PassthroughGate; |
195 |
|
|
196 |
|
TMultilockGate = class(TIpcCommon,IMultiLockGate) |
197 |
|
private |
198 |
< |
FSharedMemory: ISharedMemoryExt; |
198 |
> |
FSharedMemory: ISharedMemory; |
199 |
|
FOnGateTimeout: TNotifyEvent; |
200 |
|
FSemaphore: cint; |
201 |
|
FMutex: cint; |
202 |
|
FLockCount: PInteger; |
203 |
|
function GetLockCount: integer; |
204 |
|
public |
205 |
< |
constructor Create(SemNum: cint; sm: ISharedMemoryExt); |
205 |
> |
constructor Create(SemNum: cint; sm: ISharedMemory); |
206 |
|
procedure Lock; |
207 |
|
procedure Unlock; |
208 |
|
procedure PassthroughGate; |
217 |
|
TIPCInterface = class(TIpcCommon,IIPCInterface) |
218 |
|
private |
219 |
|
FMaxBufferSize: integer; |
220 |
< |
FSharedMemory: ISharedMemoryExt; |
220 |
> |
FSharedMemory: ISharedMemory; |
221 |
|
FWriteLock: IMutex; |
222 |
|
FBuffer: PByte; |
223 |
|
FTraceDataType, |
240 |
|
function GetReadFinishedEvent: IMultiLockGate; |
241 |
|
function GetWriteLock: IMutex; |
242 |
|
function GetMonitorCount: integer; |
240 |
– |
function GetSharedMemory: ISharedMemory; |
243 |
|
function GetMaxBufferSize: integer; |
244 |
|
property DataAvailableEvent: ISingleLockGate read GetDataAvailableEvent; |
245 |
|
property WriterBusyEvent: ISingleLockGate read GetWriterBusyEvent; |
247 |
|
property ReadFinishedEvent: IMultiLockGate read GetReadFinishedEvent; |
248 |
|
property WriteLock: IMutex read GetWriteLock; |
249 |
|
property MonitorCount: integer read GetMonitorCount; |
248 |
– |
property SharedMemory: ISharedMemory read GetSharedMemory; |
250 |
|
property MaxBufferSize: integer read GetMaxBufferSize; |
251 |
|
end; |
252 |
|
|
471 |
|
Result := FWaitingThreads^ |
472 |
|
end; |
473 |
|
|
474 |
< |
constructor TSingleLockGate.Create(SemNum: cint; sm: ISharedMemoryExt); |
474 |
> |
constructor TSingleLockGate.Create(SemNum: cint; sm: ISharedMemory); |
475 |
|
begin |
476 |
|
inherited Create; |
477 |
|
FSharedMemory := sm; |
526 |
|
|
527 |
|
{ TMultilockGate } |
528 |
|
|
529 |
< |
constructor TMultilockGate.Create(SemNum: cint; sm: ISharedMemoryExt); |
529 |
> |
constructor TMultilockGate.Create(SemNum: cint; sm: ISharedMemory); |
530 |
|
begin |
531 |
|
inherited Create; |
532 |
|
FSemaphore := SemNum; |
609 |
|
Result := GetSemValue(cMonitorCounter) |
610 |
|
end; |
611 |
|
|
611 |
– |
function TIPCInterface.GetSharedMemory: ISharedMemory; |
612 |
– |
begin |
613 |
– |
Result := FSharedMemory; |
614 |
– |
end; |
615 |
– |
|
612 |
|
function TIPCInterface.GetMaxBufferSize: integer; |
613 |
|
begin |
614 |
|
Result := FMaxBufferSize; |