Changeset 47


Ignore:
Timestamp:
Jan 7, 2007, 12:46:26 AM (18 years ago)
Author:
イグトランス (egtra)
Message:

戻り値型の間違い

File:
1 edited

Legend:

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

    r46 r47  
    2525    End Sub
    2626
    27     Sub WaitOne()
    28         WaitOne(INFINITE, FALSE)
    29     End Sub
     27    Function WaitOne() As BOOL
     28        Return WaitOne(INFINITE, FALSE)
     29    End Function
    3030
    31     Sub WaitOne(millisecondsTimeout As Long, exitContext As BOOL)
    32         WaitHandle.ExitThreadIfWaitIsFailed(WaitForSingleObject(h, millisecondsTimeout As DWord))
    33     End Sub
     31    Function WaitOne(millisecondsTimeout As Long, exitContext As BOOL) As BOOL
     32        Return WaitHandle.AfterWait(WaitForSingleObject(h, millisecondsTimeout As DWord), 1)
     33    End Function
    3434
    35 '   Sub WaitOne(timeout As TimeSpan, exitContext As BOOL)
     35'   Function WaitOne(timeout As TimeSpan, exitContext As BOOL) As BOOL
    3636/*
    37     Static Sub WaitAll(count As DWord, handles As *HANDLE)
    38         WaitAll(count, handles, INFINITE, FALSE)
    39     End Sub
     37    Static Function WaitAll(count As DWord, handles As *HANDLE) As BOOL
     38        Return WaitAll(count, handles, INFINITE, FALSE)
     39    End Function
    4040
    41     Static Sub WaitAll(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL)
    42         WaitHandle.ExitThreadIfWaitIsFailed(WaitForMultipleObjects(count, handles, TRUE, millisecondsTimeout))
    43     End Sub
     41    Static Function WaitAll(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
     42        Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, TRUE, millisecondsTimeout), count)
     43    End Function
    4444
    45 '   Static Sub WaitAll(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL)
     45'   Static Function WaitAll(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
    4646
    47     Static Sub WaitAny(count As DWord, handles As *HANDLE)
    48         WaitAny(count, handles, INFINITE, FALSE)
    49     End Sub
     47    Static Function WaitAny(count As DWord, handles As *HANDLE) As BOOL
     48        Return WaitAny(count, handles, INFINITE, FALSE)
     49    End Function
    5050
    51     Static Sub WaitAny(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL)
    52         WaitHandle.ExitThreadIfWaitIsFailed(WaitForMultipleObjects(count, handles, FALSE, millisecondsTimeout))
    53     End Sub
     51    Static Function WaitAny(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
     52        Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, FALSE, millisecondsTimeout), count)
     53    End Function
    5454
    55 '   Static Sub WaitAny(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL)
     55'   Static Function WaitAny(timeout As TimeSpan, handles As *HANDLE, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
    5656*/
    57     Static Sub SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle)
    58         SignalAndWait(toSignal, toWaitOn, INFINITE, FALSE)
    59     End Sub
     57    Static Function SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle) As BOOL
     58        Return SignalAndWait(toSignal, toWaitOn, INFINITE, FALSE)
     59    End Function
    6060
    61     Static Sub SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As BOOL)
     61    Static Function SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
    6262        Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") _
    6363            As *Function(hObjectToSignal As HANDLE, hObjectToWaitOn As HANDLE, dwMilliseconds As DWord, bAlertable As DWord) As DWord
     
    6767            ExitThread(0)
    6868        End If
    69         ExitThreadIfWaitIsFailed(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord))
    70     End Sub
     69        Return AfterWait(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord), 1)
     70    End Function
    7171
    72 '   Static Sub SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, timeout As TimeSpan, exitContext As BOOL)
     72'   Static Function SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, timeout As TimeSpan, exitContext As BOOL) As BOOL
    7373
    7474' Protected
     
    8282    h As HANDLE
    8383
    84     Static Sub ExitThreadIfWaitIsFailed(ret As DWord)
     84    Static Function AfterWait(ret As DWord, n As DWord) As BOOL
    8585        Select Case ret
    86             Case WAIT_OBJECT_0
    87                 Exit Sub
    8886            Case WAIT_TIMEOUT
    89                 Exit Sub
     87                Return FALSE
    9088            Case WAIT_ABANDONED
    9189                ' Throw AbandonedMutexException
     
    9492            'Case WAIT_FAILED
    9593            Case Else
     94                If WAIT_OBJECT_0 <= ret And ret < WAIT_OBJECT_0 + n Then
     95                    Return TRUE
     96                End If
    9697                ' ObjectDisposedException?
    9798                Debug
Note: See TracChangeset for help on using the changeset viewer.