Q&A

  • OnTerminate가 뭐하는거에요??
procedure TThreadSortForm.StartBtnClick(Sender: TObject);

begin

RandomizeArrays;

ThreadsRunning := 3;

with TBubbleSort.Create(BubbleSortBox, BubbleSortArray) do

OnTerminate := ThreadDone;

with TSelectionSort.Create(SelectionSortBox, SelectionSortArray) do

OnTerminate := ThreadDone;

with TQuickSort.Create(QuickSortBox, QuickSortArray) do

OnTerminate := ThreadDone;

StartBtn.Enabled := False;

end;



쓰레드 예제 소스에 이렇게 되어있는데..

OnTerminate 는 변수선언된 부분도 없는것 같고.. 함수도 아닌것 같고..

뭐하는 놈이에요??

그리구..

OnTerminate := ThreadDone;

는 왜 해주는 거죠??





2  COMMENTS
  • Profile
    바부이니 2001.10.25 19:48
    Occurs after the thread's Execute method has returned and before the thread is destroyed.

    property OnTerminate: TNotifyEvent;



    그러니깐 쓰레드가 끝나면 ThreadDone이라는 이벤트를 발생시킨다는 말인거 같네여?



    드기 wrote:

    > procedure TThreadSortForm.StartBtnClick(Sender: TObject);

    > begin

    > RandomizeArrays;

    > ThreadsRunning := 3;

    > with TBubbleSort.Create(BubbleSortBox, BubbleSortArray) do

    > OnTerminate := ThreadDone;

    > with TSelectionSort.Create(SelectionSortBox, SelectionSortArray) do

    > OnTerminate := ThreadDone;

    > with TQuickSort.Create(QuickSortBox, QuickSortArray) do

    > OnTerminate := ThreadDone;

    > StartBtn.Enabled := False;

    > end;

    >

    > 쓰레드 예제 소스에 이렇게 되어있는데..

    > OnTerminate 는 변수선언된 부분도 없는것 같고.. 함수도 아닌것 같고..

    > 뭐하는 놈이에요??

    > 그리구..

    > OnTerminate := ThreadDone;

    > 는 왜 해주는 거죠??

    >

    >

  • Profile
    이경문 2001.10.27 07:58
    OnTerminate라는 것은 win32 API에 있는 것이 아니고

    TThread라는 class에서 제공하는 것입니다.

    thread에 대해서 확실히 이해를 하고 싶으시면

    win32로 한번 작성을 해 보시는 게 좋을 겁니다.



    예를 들어

    MyThread.Terminate

    라는 것은

    thread를 종료시키는 것으로 판단될 수 있지만

    실제적으로 exit condition만 setting하는 것이지요.



    결국에는 잘 만들어진 TThread를 사용하게 되겠지만

    thread에 대해 잘 알려면

    win32 API를 사용해 보시는 게 좋습니다.



    바부이니 wrote:

    > Occurs after the thread's Execute method has returned and before the thread is destroyed.

    > property OnTerminate: TNotifyEvent;

    >

    > 그러니깐 쓰레드가 끝나면 ThreadDone이라는 이벤트를 발생시킨다는 말인거 같네여?

    >

    > 드기 wrote:

    > > procedure TThreadSortForm.StartBtnClick(Sender: TObject);

    > > begin

    > > RandomizeArrays;

    > > ThreadsRunning := 3;

    > > with TBubbleSort.Create(BubbleSortBox, BubbleSortArray) do

    > > OnTerminate := ThreadDone;

    > > with TSelectionSort.Create(SelectionSortBox, SelectionSortArray) do

    > > OnTerminate := ThreadDone;

    > > with TQuickSort.Create(QuickSortBox, QuickSortArray) do

    > > OnTerminate := ThreadDone;

    > > StartBtn.Enabled := False;

    > > end;

    > >

    > > 쓰레드 예제 소스에 이렇게 되어있는데..

    > > OnTerminate 는 변수선언된 부분도 없는것 같고.. 함수도 아닌것 같고..

    > > 뭐하는 놈이에요??

    > > 그리구..

    > > OnTerminate := ThreadDone;

    > > 는 왜 해주는 거죠??

    > >

    > >