Changeset 597 for trunk


Ignore:
Timestamp:
Aug 19, 2008, 1:54:54 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

ThreadStartを引数に取るThreadコンストラクタを追加。

File:
1 edited

Legend:

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

    r577 r597  
    4646Delegate Sub ThreadStart()
    4747
    48 
    4948/*
    5049関数ポインタ
    5150*/
    5251TypeDef PTHREAD_START_ROUTINE = *Function(args As VoidPtr) As DWord
    53 
    5452
    5553/*
     
    10199        throwingParamObject = Nothing
    102100    End Sub
    103 
     101    Sub Thread(threadStart As ThreadStart)
     102        m_hThread=0
     103        m_dwThreadId=0
     104        m_Priority=ThreadPriority.Normal
     105
     106        m_fp=AddressOf(threadStartEntry)
     107        m_args=ActiveBasic.AllocObjectHandle(threadStart) As VoidPtr
     108
     109        name = "sub thread"
     110        state = ThreadState.Unstarted
     111
     112        isThrowing = False
     113        throwingParamObject = Nothing
     114    End Sub
    104115    Sub Thread(obj As Thread)
    105116        m_hThread=obj.m_hThread
     
    251262    End Function
    252263
     264    Static Function threadStartEntry(pThreadStart As VoidPtr) As DWord
     265        Dim threadStart = ActiveBasic.ReleaseObjectHandle(pThreadStart As LONG_PTR) As ThreadStart
     266        threadStart()
     267    End Function
     268
    253269    /*------------------------ システム用 --------------------------*/
    254270Public
     
    316332        For i=0 To ELM(ThreadNum)
    317333            With collection[i]
    318                 If ActiveBasic.IsNothing( .thread ) Then
     334                If Not ActiveBasic.IsNothing( .thread ) Then
    319335                    .thread = Nothing
    320336                    .stackBase = 0
Note: See TracChangeset for help on using the changeset viewer.