Changeset 269 for Include/Classes/ActiveBasic/Windows/CriticalSection.ab
- Timestamp:
- Jun 2, 2007, 7:08:26 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/ActiveBasic/Windows/CriticalSection.ab
r261 r269 6 6 Namespace Windows 7 7 8 Namespace Detail 9 Const InterlockedExchangeAnyPointer(p, x) = InterlockedExchangePointer(VarPtr(p) As VoidPtr, x) 10 End Namespace 11 8 12 Class CriticalSection 9 Inherits System.IDisposable13 ' Inherits System.IDisposable 10 14 Public 11 15 Sub CriticalSection() … … 18 22 End Sub 19 23 20 OverrideSub Dispose()24 /*Override*/ Sub Dispose() 21 25 If InterlockedIncrement(disposed) = 0 Then 22 26 DeleteCriticalSection(cs) … … 24 28 End Sub 25 29 26 Function Enter() As CriticalSectionLock30 Function Enter() As ActiveBasic.Windows.CriticalSectionLock 27 31 Return New CriticalSectionLock(cs) 28 32 End Function … … 33 37 34 38 Class CriticalSectionLock 35 Inherits System.IDisposable39 ' Inherits System.IDisposable 36 40 Public 37 41 Sub CriticalSectionLock(ByRef cs As CRITICAL_SECTION) … … 48 52 End Sub 49 53 50 OverrideSub Dispose()51 Dim p = InterlockedExchange Pointer(ByVal VarPtr(pcs), 0)54 /*Override*/ Sub Dispose() 55 Dim p = InterlockedExchangeAnyPointer(pcs, 0) 52 56 If p <> 0 Then 53 57 LeaveCriticalSection(ByVal p)
Note:
See TracChangeset
for help on using the changeset viewer.