Annotation of sbbs/src/xpdev/clx/threadcreate/mainunit.cpp, revision 1.1.1.1

1.1       root        1: //---------------------------------------------------------------------------
                      2: 
                      3: #include <clx.h>
                      4: #pragma hdrstop
                      5: 
                      6: #include "MainUnit.h"
                      7: #include "ThreadUnit.h"
                      8: 
                      9: //---------------------------------------------------------------------------
                     10: #pragma package(smart_init)
                     11: #pragma resource "*.xfm"
                     12: TForm1 *Form1;
                     13: //---------------------------------------------------------------------------
                     14: __fastcall TForm1::TForm1(TComponent* Owner)
                     15:        : TForm(Owner)
                     16: {
                     17:        CriticalSection = new TCriticalSection();
                     18:     List = new TList();
                     19: }
                     20: //---------------------------------------------------------------------------
                     21: void __fastcall TForm1::CreateButtonClick(TObject *Sender)
                     22: {
                     23:        TMyThread* NewThread = new TMyThread(true);
                     24: 
                     25:     NewThread->List=List;
                     26:     NewThread->Log=Log;
                     27:     NewThread->CriticalSection = CriticalSection;
                     28:     ListBox->Items->AddObject(NewThread->ThreadID, NewThread);
                     29:     NewThread->Resume();
                     30: }
                     31: //---------------------------------------------------------------------------
                     32: void __fastcall TForm1::KillButtonClick(TObject *Sender)
                     33: {
                     34:        for(int i=0;i<ListBox->Items->Count;i++)
                     35:        if(ListBox->Selected[i]) {
                     36:                TMyThread* MyThread = (TMyThread*)ListBox->Items->Objects[i];
                     37:             MyThread->FreeOnTerminate = true;
                     38:             MyThread->Terminate();
                     39:             ListBox->Items->Delete(i);
                     40:         }
                     41: }
                     42: //---------------------------------------------------------------------------
                     43: void __fastcall TForm1::TimerTick(TObject *Sender)
                     44: {
                     45:        StatusBar->SimpleText = AnsiString(List->Count);
                     46: }
                     47: //---------------------------------------------------------------------------
                     48: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.