Changeset 408 for trunk/Include


Ignore:
Timestamp:
Feb 21, 2008, 8:48:14 PM (17 years ago)
Author:
NoWest
Message:

あまりに久しぶりの参加で調子でないです(笑
一先ず肩慣らしにWaitHandleの実装を進めておきました。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Threading/WaitHandle.ab

    r388 r408  
    2929
    3030    ' Methods
     31    Virtual Sub WaitHandle()
     32    End Sub
    3133
    3234    Virtual Sub ~WaitHandle()
    33         Dispose()
     35        This.Dispose()
    3436    End Sub
    3537
    3638    Virtual Sub Close()
    37         Dispose()
     39        This.Dispose()
    3840    End Sub
    3941
     
    5355    End Function
    5456
    55 '   Function WaitOne(timeout As TimeSpan, exitContext As BOOL) As BOOL
    56 /*
    57     Static Function WaitAll(count As DWord, handles As *HANDLE) As BOOL
     57    Function WaitOne(timeout As System.TimeSpan, exitContext As Boolean) As Boolean
     58        Return WaitHandle.AfterWait(WaitForSingleObject(h, timeout.TotalMilliseconds() As DWord), 1)
     59    End Function
     60
     61    Static Function WaitAll(count As DWord, handles As *HANDLE) As Boolean
    5862        Return WaitAll(count, handles, INFINITE, FALSE)
    5963    End Function
    6064
    61     Static Function WaitAll(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
     65    Static Function WaitAll(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As Boolean) As Boolean
    6266        Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, TRUE, millisecondsTimeout), count)
    6367    End Function
    6468
    65 '   Static Function WaitAll(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
     69    Static Function WaitAll(count As DWord, handles As *HANDLE, timeout As System.TimeSpan, exitContext As Boolean) As Boolean
     70        Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, TRUE, timeout.TotalMilliseconds() As DWord), count)
     71    End Function
    6672
    67     Static Function WaitAny(count As DWord, handles As *HANDLE) As BOOL
     73    Static Function WaitAny(count As DWord, handles As *HANDLE) As Boolean
    6874        Return WaitAny(count, handles, INFINITE, FALSE)
    6975    End Function
    7076
    71     Static Function WaitAny(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
     77    Static Function WaitAny(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As Boolean) As Boolean
    7278        Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, FALSE, millisecondsTimeout), count)
    7379    End Function
    7480
    75 '   Static Function WaitAny(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
    76 */
     81    Static Function WaitAny(count As DWord, handles As *HANDLE, timeout As System.TimeSpan, exitContext As Boolean) As Boolean
     82        Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, FALSE, timeout.TotalMilliseconds() As DWord), count)
     83    End Function
     84
    7785    Static Function SignalAndWait(toSignal As WaitHandle, toWaitOn As WaitHandle) As Boolean
    7886        Return SignalAndWait(toSignal, toWaitOn, INFINITE, FALSE)
    7987    End Function
    8088
    81 Public
     89    Static Function SignalAndWait (toSignal As WaitHandle, toWaitOn As WaitHandle, timeout As System.TimeSpan, exitContext As Boolean) As Boolean
     90        Return SignalAndWait(toSignal, toWaitOn, timeout.TotalMilliseconds() As Long, FALSE)
     91    End Function
     92
    8293    Static Function SignalAndWait(toSignal As WaitHandle, toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As Boolean) As Boolean
    8394        Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") As Detail.PFNSignalObjectAndWait
     
    8899    End Function
    89100
    90 '   Static Function SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, timeout As TimeSpan, exitContext As BOOL) As BOOL
    91 
    92 ' Protected
    93     Sub WaitHandle()
    94     End Sub
     101Public
     102    Function WaitTimeout() As Long
     103        Return WAIT_TIMEOUT
     104    End Function
    95105
    96106Protected
Note: See TracChangeset for help on using the changeset viewer.