Ignore:
Timestamp:
Aug 20, 2008, 3:37:44 AM (16 years ago)
Author:
イグトランス (egtra)
Message:

ThreadPoolの実装、WaitHandle.WaitAny/WaitAllのまともな実装、ほか。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/Threading/Thread.ab

    r597 r599  
    460460
    461461    Function FindThreadInfo(threadID As DWord) As *ThreadInfo
     462        EnterCriticalSection(CriticalSection)
    462463        Dim i As Long
    463464        For i = 0 To ELM(ThreadNum)
     
    467468            End If
    468469        Next
     470        LeaveCriticalSection(CriticalSection)
    469471    End Function
    470472
     
    476478Public
    477479    Function GetCurrentException() As ExceptionService
     480        EnterCriticalSection(CriticalSection)
    478481        Dim dwNowThreadId = GetCurrentThreadId()
    479 
    480482        Dim i As Long
    481483        For i=0 To ELM(ThreadNum)
    482484            With collection[i]
    483485                If .thread.ThreadId = dwNowThreadId Then
    484                     Return .exception
     486                    GetCurrentException = .exception
     487                    Exit For
    485488                End If
    486489            End With
    487490        Next
    488 
    489         OutputDebugString( Ex"カレントスレッドの取得に失敗\r\n" )
    490         Return Nothing
     491        LeaveCriticalSection(CriticalSection)
     492        If ActiveBasic.IsNothing(GetCurrentException) Then
     493            OutputDebugString(Ex"カレントスレッドの取得に失敗\r\n")
     494        End If
    491495    End Function
    492496End Class
Note: See TracChangeset for help on using the changeset viewer.