- Timestamp:
- May 26, 2007, 1:08:15 AM (17 years ago)
- Location:
- Include/Classes
- Files:
-
- 4 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Threading/WaitHandle.ab
r258 r261 4 4 #define __SYSTEM_THREADING_WAITHANDLE_AB__ 5 5 6 'Namespace System 7 'Namespace Threading 6 #require <Classes/System/misc.ab> 7 8 Namespace System 9 Namespace Threading 8 10 9 11 Namespace Detail … … 12 14 13 15 Class WaitHandle 16 Inherits System.IDisposable 14 17 Public 15 18 ' Properties … … 28 31 29 32 Virtual Sub ~WaitHandle() 30 CloseHandle(h)33 Dispose() 31 34 End Sub 32 35 33 36 Virtual Sub Close() 34 CloseHandle(h)37 Dispose() 35 38 End Sub 36 39 37 Function WaitOne() As BOOL 40 Override Sub Dispose() 41 Dim hDisposing = InterlockedExchangePointer(h, 0) 42 If hDisposing <> 0 Then 43 CloseHandle(hDisposing) 44 End If 45 End Sub 46 47 Function WaitOne() As Boolean 38 48 Return WaitOne(INFINITE, FALSE) 39 49 End Function 40 50 41 Function WaitOne(millisecondsTimeout As Long, exitContext As BOOL) As B OOL51 Function WaitOne(millisecondsTimeout As Long, exitContext As BOOL) As Boolean 42 52 Return WaitHandle.AfterWait(WaitForSingleObject(h, millisecondsTimeout As DWord), 1) 43 53 End Function … … 65 75 ' Static Function WaitAny(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL 66 76 */ 67 Static Function SignalAndWait( ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle) As BOOL77 Static Function SignalAndWait(toSignal As WaitHandle, toWaitOn As WaitHandle) As Boolean 68 78 Return SignalAndWait(toSignal, toWaitOn, INFINITE, FALSE) 69 79 End Function 70 80 71 81 Public 72 Static Function SignalAndWait( ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As BOOL) As BOOL82 Static Function SignalAndWait(toSignal As WaitHandle, toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As BOOL) As Boolean 73 83 Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") As Detail.PFNSignalObjectAndWait 74 84 If pSignalObjectAndWait = 0 Then … … 92 102 h As HANDLE 93 103 94 Static Function AfterWait(ret As DWord, n As DWord) As B OOL104 Static Function AfterWait(ret As DWord, n As DWord) As Boolean 95 105 Select Case ret 96 106 Case WAIT_TIMEOUT 97 Return F ALSE107 Return False 98 108 Case WAIT_ABANDONED 99 109 ' Throw AbandonedMutexException … … 103 113 Case Else 104 114 If WAIT_OBJECT_0 <= ret And ret < WAIT_OBJECT_0 + n Then 105 Return T RUE115 Return True 106 116 End If 107 117 ' ObjectDisposedException? … … 112 122 End Class 113 123 114 'End Namespace 'Threading115 'End Namespace 'System124 End Namespace 'Threading 125 End Namespace 'System 116 126 117 127 #endif '__SYSTEM_THREADING_WAITHANDLE_AB__ -
Include/Classes/System/misc.ab
r223 r261 4 4 #define __SYSTEM_MISC_AB__ 5 5 6 #require <Classes/System/Threading/WaitHandle.ab>6 '#require <Classes/System/Threading/WaitHandle.ab> 7 7 8 Interface IObject 9 End Interface 8 Namespace System 10 9 11 10 Interface IAsyncResult 12 11 ' Properties 13 Function AsyncState() As *IObject14 Function AsyncWaitHandle() As WaitHandle15 Function CompletedSynchronously() As B OOL16 Function IsCompleted() As B OOL12 Function AsyncState() As Object 13 Function AsyncWaitHandle() As System.Threading.WaitHandle 14 Function CompletedSynchronously() As Boolean 15 Function IsCompleted() As Boolean 17 16 End Interface 18 17 19 18 Interface IClonable 20 19 ' Method 21 Function Clone() As *IObject20 Function Clone() As Object 22 21 End Interface 23 22 24 23 Interface IComparable 25 24 ' Method 26 Function CompareTo(ByRef obj As IObject) As Long 25 Function CompareTo(obj As Object) As Long 26 End Interface 27 28 Interface IDisposable 29 ' Method 30 Sub Dispose() 27 31 End Interface 28 32 … … 32 36 End Class 33 37 38 End Namespace 'System 39 #require <Classes/System/Threading/WaitHandle.ab> 40 34 41 #endif '__SYSTEM_MISC_AB__
Note:
See TracChangeset
for help on using the changeset viewer.