Changeset 171 for Include/system


Ignore:
Timestamp:
Mar 17, 2007, 6:01:56 AM (18 years ago)
Author:
dai
Message:

スウィープ中に呼ばれたデストラクタの中で、GC関連のメソッドを呼ぶとデッドロックしてしまうバグを修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/system/gc.sbp

    r170 r171  
    198198
    199199    Sub sweep()
    200         EnterCriticalSection(CriticalSection)
    201             If iAllSize<limitMemorySize Then
    202                 'メモリ使用量が上限値を超えていないとき
    203                 LeaveCriticalSection(CriticalSection)
    204                 Exit Sub
    205             End If
    206 
    207             OutputDebugString( Ex"garbage colletion sweep start!\r\n" )
    208 
    209             Dim hThread As HANDLE
    210             Dim ThreadId As DWord
    211             hThread=_beginthreadex(NULL,0,AddressOf(SweepOnOtherThread),VarPtr(This),0,ThreadId)
    212             WaitForSingleObject(hThread,INFINITE)
    213             CloseHandle(hThread)
    214         LeaveCriticalSection(CriticalSection)
     200        If iAllSize<limitMemorySize Then
     201            'メモリ使用量が上限値を超えていないとき
     202            Exit Sub
     203        End If
     204
     205        OutputDebugString( Ex"garbage colletion sweep start!\r\n" )
     206
     207        Dim hThread As HANDLE
     208        Dim ThreadId As DWord
     209        hThread=_beginthreadex(NULL,0,AddressOf(SweepOnOtherThread),VarPtr(This),0,ThreadId)
     210        WaitForSingleObject(hThread,INFINITE)
     211        CloseHandle(hThread)
    215212    End Sub
    216213
     
    348345    ' スウィープ(新規スレッドで呼び出し)
    349346    Function Cdecl SweepOnOtherThread() As Long
     347        EnterCriticalSection(CriticalSection)
    350348
    351349        ' すべてのスレッドを一時停止
     
    399397        '-------------------------------------
    400398        _System_pobj_AllThreads->ResumeAllThread()
     399
     400        LeaveCriticalSection(CriticalSection)
    401401    End Function
    402402
Note: See TracChangeset for help on using the changeset viewer.