From: <jfu...@us...> - 2007-06-04 21:03:00
|
Revision: 11312 http://svn.sourceforge.net/jvcl/?rev=11312&view=rev Author: jfudickar Date: 2007-06-04 14:02:57 -0700 (Mon, 04 Jun 2007) Log Message: ----------- Updated BCB Example Modified Paths: -------------- trunk/jvcl/examples/JvThread/BCB/JvThreadProj.bpr trunk/jvcl/examples/JvThread/BCB/JvThreadProj.cpp trunk/jvcl/examples/JvThread/BCB/JvThreadProj.res trunk/jvcl/examples/JvThread/BCB/fThread.cpp trunk/jvcl/examples/JvThread/BCB/fThread.dfm trunk/jvcl/examples/JvThread/BCB/fThread.h Modified: trunk/jvcl/examples/JvThread/BCB/JvThreadProj.bpr =================================================================== --- trunk/jvcl/examples/JvThread/BCB/JvThreadProj.bpr 2007-06-04 20:27:36 UTC (rev 11311) +++ trunk/jvcl/examples/JvThread/BCB/JvThreadProj.bpr 2007-06-04 21:02:57 UTC (rev 11312) @@ -1,21 +1,37 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version='1.0' encoding='utf-8' ?> <!-- C++Builder XML Project --> <PROJECT> <MACROS> <VERSION value="BCB.06.00"/> <PROJECT value="..\..\..\bin\JvThreadProj.exe"/> - <OBJFILES value="..\..\..\dcu\JvThreadProj.obj ..\..\..\dcu\fThread.obj"/> + <OBJFILES value="..\..\..\dcu\JvThread.obj ..\..\..\dcu\JvThreadProj.obj + ..\..\..\dcu\fThread.obj"/> <RESFILES value="JvThreadProj.res"/> <IDLFILES value=""/> <IDLGENFILES value=""/> <DEFFILE value=""/> <RESDEPEN value="$(RESFILES) fThread.dfm"/> <LIBFILES value=""/> - <LIBRARIES value=""/> - <SPARELIBS value=""/> - <PACKAGES value=""/> + <LIBRARIES value="JVSTDCTRLSC5R.lib JVSYSTEMC5R.lib VCLDB50.lib VCLX50.lib JCLC50.lib + JVCOREC5R.lib Vcl50.lib"/> + <SPARELIBS value="Vcl50.lib JVCOREC5R.lib JCLC50.lib VCLX50.lib VCLDB50.lib JVSYSTEMC5R.lib + JVSTDCTRLSC5R.lib"/> + <PACKAGES value="Vcl50.bpi Vclx50.bpi Vcldb50.bpi vclado50.bpi ibsmp50.bpi VCLBDE50.bpi + vcldbx50.bpi VCLIB50.bpi EHLIBB50.bpi CPORTLIBCB5.bpi VERSIONINFO50.bpi + madBasic_.bpi madDisAsm_.bpi madExcept_.bpi bcbsmp50.bpi TEE7C5.bpi + TEEDB7C5.bpi TEEUI7C5.bpi TEEPRO7C5.bpi TEELANGUAGE7C5.bpi TEEGL7C5.bpi + TEEQR7C5.bpi QRPT50.bpi TeeImage7C5.bpi Vclmid50.bpi vclie50.bpi + Inetdb50.bpi Inet50.bpi NMFast50.bpi webmid50.bpi bcbie50.bpi dclocx50.bpi + bcb2kaxserver50.bpi dclusr50.bpi VCLSMP50.bpi JCLC50.bpi JVCOREC5R.bpi + JVSTDCTRLSC5R.bpi JVSYSTEMC5R.bpi JVAPPFRMC5R.bpi JVCTRLSC5R.bpi + JVBANDSC5R.bpi JVBDEC5R.bpi JVDLGSC5R.bpi JVDBC5R.bpi JVCMPC5R.bpi + JVCRYPTC5R.bpi JVCUSTOMC5R.bpi JVDOCKINGC5R.bpi JVDOTNETCTRLSC5R.bpi + JVEDIC5R.bpi JVHMIC5R.bpi JVINTERPRETERC5R.bpi JVJANSC5R.bpi + JVMANAGEDTHREADSC5R.bpi JVMMC5R.bpi JVNETC5R.bpi JVPAGECOMPSC5R.bpi + JVPLUGINC5R.bpi JVPRINTPREVIEWC5R.bpi JVTIMEFRAMEWORKC5R.bpi JVUIBC5R.bpi + JVVALIDATORSC5R.bpi JVWIZARDC5R.bpi JVXPCTRLSC5R.bpi JVGLOBUSC5R.bpi"/> <PATHCPP value=".;"/> - <PATHPAS value=".;"/> + <PATHPAS value=".;..\..\..\run"/> <PATHRC value=".;"/> <PATHASM value=".;"/> <DEBUGLIBPATH value="$(BCB)\lib\debug"/> @@ -24,16 +40,21 @@ <USERDEFINES value="_DEBUG"/> <SYSDEFINES value="NO_STRICT"/> <MAINSOURCE value="JvThreadProj.cpp"/> - <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\..\..\run;..\..\..\common"/> - <LIBPATH value="$(BCB)\lib\debug;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;..\..\..\Resources"/> + <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\..\..\run;..\..\..\common;..\..\..\..\..\..\..\madCollection\madBasic\BCB5;..\..\..\..\..\..\..\madCollection\madDisAsm\BCB5;..\..\..\..\..\..\..\madCollection\madExcept\BCB5;..\..\..\..\..\..\..\madCollection\Plugins;""/> + <LIBPATH value="..\..\..\run;$(BCB)\USERCO~1\JCL\lib\c5;$(BCB)\USERCO~1\JVCL\lib\c5;$(BCB)\lib\debug;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;..\..\..\Resources;..\..\..\..\..\..\..\madCollection\madBasic\BCB5;..\..\..\..\..\..\..\madCollection\madDisAsm\BCB5;..\..\..\..\..\..\..\madCollection\madExcept\BCB5;..\..\..\..\..\..\..\madCollection\Plugins;""/> <WARNINGS value="-w-par"/> </MACROS> <OPTIONS> - <IDLCFLAGS value="-I$(BCB)\include -I$(BCB)\include\vcl -I$(INCLUDEPATH) -src_suffix cpp - -D_DEBUG -boa"/> - <CFLAG1 value="-Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c - -tW -tWM"/> - <PFLAGS value="-N2..\..\..\dcu -N0..\..\..\dcu -$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <IDLCFLAGS value="-src_suffix cpp -D_DEBUG -I$(BCB)\include -I$(BCB)\include\vcl + -I..\..\..\run -I..\..\..\common + -I..\..\..\..\..\..\..\madCollection\madBasic\BCB5 + -I..\..\..\..\..\..\..\madCollection\madDisAsm\BCB5 + -I..\..\..\..\..\..\..\madCollection\madExcept\BCB5 + -I..\..\..\..\..\..\..\madCollection\Plugins + -I -boa"/> + <CFLAG1 value="-vGc -vGt -vGd -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -6 -b- + -k -y -v -vi- -c -tW -tWM"/> + <PFLAGS value="-N2..\..\..\dcu -N0..\..\..\dcu -$Y+ -$W -$O- -$A8 -v -JPHNE -M -LUvcl50"/> <RFLAGS value=""/> <AFLAGS value="/mx /w2 /zd"/> <LFLAGS value="-I..\..\..\dcu -D"" -aa -Tpe -x -Gn -v"/> @@ -41,9 +62,10 @@ <LINKER> <ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/> <ALLRES value="$(RESFILES)"/> - <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/> + <ALLLIB value="cg32.lib $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/> </LINKER> - <IDEOPTIONS>[Version Info] + <IDEOPTIONS> +[Version Info] IncludeVerInfo=1 AutoIncBuild=0 MajorVer=1 @@ -58,5 +80,61 @@ Locale=1036 CodePage=1252 -</IDEOPTIONS> -</PROJECT> +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 + +[Excluded Packages] +$(BCB)\Bin\dcldss50.bpl=Borland Decision Cube Components + +[HistoryLists\hlIncludePath] +Count=0 + +[HistoryLists\hlLibraryPath] +Count=0 + +[HistoryLists\hlConditionals] +Count=1 +Item0=_DEBUG + +[HistoryLists\hlIntOutputDir] +Count=1 +Item0=..\..\..\dcu + +[HistoryLists\hlFinalOutputDir] +Count=1 +Item0=..\..\..\bin\ + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=1 +LinkCGLIB=1 + +[CORBA] +AddServerUnit=1 +AddClientUnit=1 +PrecompiledHeaders=1 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + </IDEOPTIONS> +</PROJECT> \ No newline at end of file Modified: trunk/jvcl/examples/JvThread/BCB/JvThreadProj.cpp =================================================================== --- trunk/jvcl/examples/JvThread/BCB/JvThreadProj.cpp 2007-06-04 20:27:36 UTC (rev 11311) +++ trunk/jvcl/examples/JvThread/BCB/JvThreadProj.cpp 2007-06-04 21:02:57 UTC (rev 11312) @@ -4,6 +4,7 @@ #pragma hdrstop USERES("JvThreadProj.res"); USEFORM("fThread.cpp", Form1); +USEUNIT("..\..\..\run\JvThread.pas"); //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { Modified: trunk/jvcl/examples/JvThread/BCB/JvThreadProj.res =================================================================== (Binary files differ) Modified: trunk/jvcl/examples/JvThread/BCB/fThread.cpp =================================================================== --- trunk/jvcl/examples/JvThread/BCB/fThread.cpp 2007-06-04 20:27:36 UTC (rev 11311) +++ trunk/jvcl/examples/JvThread/BCB/fThread.cpp 2007-06-04 21:02:57 UTC (rev 11312) @@ -29,6 +29,7 @@ #include <vcl.h> #pragma hdrstop +#include <stdlib.h> #include "fThread.h" //--------------------------------------------------------------------------- @@ -36,165 +37,549 @@ #pragma link "JvComponent" #pragma link "JvThread" #pragma link "JvThreadDialog" +#pragma link "JvComponentBase" +#pragma link "JvExMask" +#pragma link "JvSpin" #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- +bool SuspendRandomThread=false; +bool RaiseExceptInThread=false; +//--------------------------------------------------------------------------- +typedef struct SJobData +{ + int Dummy[10]; +} SJobData; +//--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { + randomize(); + + cbExclusive1->Checked=JvThread1->Exclusive; + cbExclusive2->Checked=JvThread2->Exclusive; + + seMaxCount1->AsInteger=JvThread1->MaxCount; + seMaxCount2->AsInteger=JvThread2->MaxCount; + + cbDeferredExecution1->Checked=!JvThread1->RunOnCreate; + cbDeferredExecution2->Checked=!JvThread2->RunOnCreate; + + cbDeferredDeletion1->Checked=!JvThread1->FreeOnTerminate; + cbDeferredDeletion2->Checked=!JvThread2->FreeOnTerminate; } //--------------------------------------------------------------------------- void __fastcall TForm1::JvThread1Execute(TObject *Sender, Pointer Params) { + TJvBaseThread* ThisThread=dynamic_cast<TJvBaseThread*>(Sender); + + if(JvThread1->Terminated) // flag 'Terminated' for current thread; slower then direct ThisThread->Terminated + { // terminated before resume + JvThread1->ReturnValue=-1; // for current thread; slower then direct ThisThread->ReturnValue + exit; + } + int i, j, k; bool FL_Break=false; + JvThread1->ReturnValue=0; // for current thread; slower then direct ThisThread->ReturnValue + //Do the job here k = 0; - for(i=0;(i<100) && !FL_Break;++i) + for(i=0;(i<1000) && !FL_Break;++i) { - for(j=0;j<100;++j) + for(j=0;j<10;++j) { ++k; - /* - I included here ::Sleep(0) unlike the original Delphi code to - allow the other threads to process as well. (c)VK - */ - ::Sleep(0); + // I included here ::Sleep(0) unlike the original Delphi code to + // allow the other threads to process as well. (c)VK + ::Sleep(0); //To use global variable/objects, you have to synchronize (to avoid conflicts) - Form1->Value = k; - JvThread1->Synchronize(Form1->Stats1); + Form1->ThreadID1 = ThisThread->ThreadID; + Form1->Value1 = k; + JvThread1->Synchronize(Form1->Stats1); // slower then direct ThisThread->Synchronize(Form1->Stats1) - if( JvThread1->Terminated) + if(SuspendRandomThread) { + SuspendRandomThread=false; + JvThread1->Suspend(); // itself + } + + if(RaiseExceptInThread) + { + RaiseExceptInThread=false; + JvThread1->ReturnValue=666; // for current thread; slower then direct ThisThread->ReturnValue + throw Exception("Exception in Job 1, ThreadID="+IntToHex((int)ThisThread->ThreadID, 8)); + } + + if(JvThread1->Terminated) // flag 'Terminated' for current thread; slower then direct ThisThread->Terminated + { FL_Break = true; + JvThread1->ReturnValue=1; break; } } } - if(!JvThread1->Terminated) - { - JvThread1->Synchronize(Form1->enableButton1); - } } //--------------------------------------------------------------------------- - void __fastcall TForm1::JvThread2Execute(TObject *Sender, Pointer Params) { - int i, j, k; - bool FL_Break=false; +// old TJvThread* Container=dynamic_cast<TJvThread*>(Sender); + + TJvBaseThread* ThisThread=dynamic_cast<TJvBaseThread*>(Sender); + if(ThisThread==NULL) + throw Exception("Execution error: 'Sender' is not TJvBaseThread object"); + + if(ThisThread->Terminated) + { + ThisThread->ReturnValue=-1; // terminated before resume + return; + } + + SJobData* Data=reinterpret_cast<SJobData*>(ThisThread->Params); // Data==Params + + TJvThread* Container=dynamic_cast<TJvThread*>(ThisThread->Container); + if(Container==NULL) + throw Exception("Execution error: container is not TJvThread component"); + + int i, j, k=0; //Do the job here - k = 0; - for(i=0;(i<100) && !FL_Break;++i) + for(i=0; i<1000 && !ThisThread->Terminated; ++i) { - for(j=0;j<10;++j) + for(j=0; j<10 && !ThisThread->Terminated; ++j) { - k +=5; //This is the only difference with the other thread - ::Sleep(13); + k+=5; //This is the only difference with the other thread + ::Sleep(Data->Dummy[1]); //To use global variable/objects, you have to synchronize (to avoid conflicts) - Form1->Value2 = k; - JvThread2->Synchronize(Form1->Stats2); + Form1->ThreadID2 = ThisThread->ThreadID; + Form1->Value2=k; + ThisThread->Synchronize(Form1->Stats2); +// or Container->Synchronize(Form1->Stats2,); // slower then direct ThisThread->Synchronize - if( JvThread2->Terminated ) + if(SuspendRandomThread) { - FL_Break = true; - break; + SuspendRandomThread=false; + JvThread2->Suspend(); // itself } + + if(RaiseExceptInThread) + { + RaiseExceptInThread=false; + ThisThread->ReturnValue=666; + throw Exception("Exception in Job 2, ThreadID="+IntToHex((int)ThisThread->ThreadID, 8)); + } } } - if(!JvThread2->Terminated) + + AnsiString s; + if(ThisThread->Terminated) { - JvThread2->Synchronize(Form1->enableButton2); - } + ThisThread->ReturnValue=1; + s="Job 2: Terminated"; + } + else + { + ThisThread->ReturnValue=0; + s="Job 2: Normal finish"; + } + + if(Data->Dummy[0]) + ThisThread->SynchMessageDlg(s+": ID=0x"+IntToHex((int)ThisThread->ThreadID, 8), mtInformation, TMsgDlgButtons()<<mbOK, 0); +// or Container->SynchMessageDlg(s+": ID=0x"+IntToHex((int)ThisThread->ThreadID, 8), mtInformation, TMsgDlgButtons()<<mbOK, 0); } //--------------------------------------------------------------------------- void __fastcall TForm1::Stats1(void) { - Label2->Caption = IntToStr(Value); + lbStats1->Caption = "ID:"+IntToHex(ThreadID1, 8)+ " V:"+IntToStr(Value1); } - void __fastcall TForm1::Stats2(void) { - Label4->Caption = IntToStr(Value2); + lbStats2->Caption = "ID:"+IntToHex(ThreadID2, 8)+ " V:"+IntToStr(Value2); } - -void __fastcall TForm1::Button1Click(TObject *Sender) +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnStartJob1Click(TObject *Sender) { - TButton *pB; - JvThread1->ThreadDialog = NULL; - JvThread1->Execute(this); - pB = dynamic_cast<TButton *>(Sender); - if(pB!=NULL) + TJvBaseThread* t=JvThread1->Execute(NULL); + if(t) { - pB->Enabled = false; + int id=t->ThreadID; + Memo->Lines->Add("Started Job 1: "+IntToHex(id, 8)); } } //--------------------------------------------------------------------------- - -void __fastcall TForm1::Button2Click(TObject *Sender) +void __fastcall TForm1::btnStartJob1SimpleDlgClick(TObject *Sender) { - TButton *pB; - + JvThread1->ThreadDialog = JvThreadSimpleDialog1; + TJvBaseThread* t=JvThread1->Execute(NULL); + if(t) + { + int id=t->ThreadID; + Memo->Lines->Add("Started Job 1 with Simple Dlg: "+IntToHex(id, 8)); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnStartJob2Click(TObject *Sender) +{ JvThread2->ThreadDialog = NULL; - JvThread2->Execute(this); - pB = dynamic_cast<TButton *>(Sender); - if(pB!=NULL) + SJobData* Data=new SJobData; + Data->Dummy[0]=cbShowMsgBeforeExit2->Checked; + Data->Dummy[1]=rand()%10; + TJvBaseThread* t=JvThread2->Execute(Data); + if(t) { - pB->Enabled = false; + int id=t->ThreadID; + Memo->Lines->Add("Started Job 2: "+IntToHex(id, 8)); } + else + delete Data; // thread was not started } //--------------------------------------------------------------------------- - -void __fastcall TForm1::Button3Click(TObject *Sender) +void __fastcall TForm1::btnStartJob2AnimatedDlgClick(TObject *Sender) { - JvThread1->ThreadDialog = JvThreadSimpleDialog1; - JvThread1->Execute(this); - //(Sender as TButton).Enabled := False; + JvThread2->ThreadDialog = JvThreadAnimateDialog1; + SJobData* Data=new SJobData; + Data->Dummy[0]=cbShowMsgBeforeExit2->Checked; + Data->Dummy[1]=rand()%10; + TJvBaseThread* t=JvThread2->Execute(Data); + if(t) + { + int id=t->ThreadID; + Memo->Lines->Add("Started Job 2 with Animated Dlg: "+IntToHex(id, 8)); + } + else + delete Data; // thread was not started +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbExclusive1Click(TObject *Sender) +{ + JvThread1->Exclusive=cbExclusive1->Checked; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbExclusive2Click(TObject *Sender) +{ + JvThread2->Exclusive=cbExclusive2->Checked; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbDeferredExecution1Click(TObject *Sender) +{ + JvThread1->RunOnCreate=!cbDeferredExecution1->Checked; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbDeferredExecution2Click(TObject *Sender) +{ + JvThread2->RunOnCreate=!cbDeferredExecution2->Checked; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbDeferredDeletion1Click(TObject *Sender) +{ + JvThread1->FreeOnTerminate=!cbDeferredDeletion1->Checked; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbDeferredDeletion2Click(TObject *Sender) +{ + JvThread2->FreeOnTerminate=!cbDeferredDeletion2->Checked; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::seMaxCount1Change(TObject *Sender) +{ + JvThread1->MaxCount=seMaxCount1->AsInteger; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::seMaxCount2Change(TObject *Sender) +{ + JvThread2->MaxCount=seMaxCount2->AsInteger; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbPriority1Change(TObject *Sender) +{ + int p=cbPriority1->ItemIndex; + if(p>=0) + { + int old=JvThread1->Priority; + JvThread1->SetPriority((TThreadPriority)p); // all threads + if(p>old) Memo->Lines->Add("Job 1 priority boosted"); + if(p<old) Memo->Lines->Add("Job 1 priority reduced"); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::cbPriority2Change(TObject *Sender) +{ + int p=cbPriority2->ItemIndex; + if(p>=0) + { + int old=JvThread2->Priority; + JvThread2->SetPriority((TThreadPriority)p); // all threads + if(p>old) Memo->Lines->Add("Job 2 priority boosted"); + if(p<old) Memo->Lines->Add("Job 2 priority reduced"); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnSuspendAll1Click(TObject *Sender) +{ + cbAutoStart1->Checked=false; + JvThread1->Suspend(); // all threads + Memo->Lines->Add("Job 1 suspended"); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnSuspendAll2Click(TObject *Sender) +{ + cbAutoStart2->Checked=false; + JvThread2->Suspend(); // all threads + Memo->Lines->Add("Job 2 suspended"); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnResumeAll1Click(TObject *Sender) +{ + JvThread1->Resume(); // all threads + Memo->Lines->Add("Job 1 resumed"); + cbAutoStart1->Enabled=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnResumeAll2Click(TObject *Sender) +{ + JvThread2->Resume(); // all threads + Memo->Lines->Add("Job 2 resumed"); + cbAutoStart2->Enabled=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnTerminate1Click(TObject *Sender) +{ + cbAutoStart1->Checked=false; + JvThread1->Terminate(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnTerminate2Click(TObject *Sender) +{ + cbAutoStart2->Checked=false; + JvThread2->Terminate(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose) +{ + Memo->Lines->Add("Application shutdown"); + cbAutoStart1->Checked=false; + cbAutoStart2->Checked=false; + + JvThread1->Terminate(); + JvThread2->Terminate(); + + Memo->Lines->Add("Waiting for Job1 completion ..."); + JvThread1->WaitFor(); + Memo->Lines->Add("Done"); + + Memo->Lines->Add("Waiting for Job2 completion ..."); + JvThread2->WaitFor(); + Memo->Lines->Add("Done"); + + if(JvThread1->Count) + { + Memo->Lines->Add("Removing zombies in Job 1 ..."); + JvThread1->RemoveZombie(); + Memo->Lines->Add("Done"); + } + + if(JvThread2->Count) + { + Memo->Lines->Add("Removing zombies in Job 2 ..."); + JvThread2->RemoveZombie(); + Memo->Lines->Add("Done"); + } + + Memo->Lines->Add("Finished"); + ::Sleep(2000); } //--------------------------------------------------------------------------- - -void __fastcall TForm1::Button4Click(TObject *Sender) +void __fastcall TForm1::JvThreadBegin(TObject *Sender) { - JvThread2->ThreadDialog = JvThreadAnimateDialog1; - JvThread2->Execute(this); - //(Sender as TButton).Enabled := False; + if(rbExOnBegin->Checked) + { + cbAutoStart1->Checked=false; + cbAutoStart2->Checked=false; + throw Exception("OnBegin"); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::JvThreadBeforeResume(TObject *Sender) +{ + if(rbExOnBeforeResume->Checked) + throw Exception("OnBeforeResume"); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::JvThread1Finish(TObject *Sender) +{ + TJvBaseThread* t=dynamic_cast<TJvBaseThread*>(Sender); + if(t) + { + int id=t->ThreadID; + int rv=t->ReturnValue; + TJvThread* Container=dynamic_cast<TJvThread*>(t->Container); + Memo->Lines->Add("Job 1 Finished: "+IntToHex(id, 8)+" result: "+IntToStr(rv)); + + if(rbExOnFinish->Checked) + { + cbAutoStart2->Checked=false; // for preventing endless exception generation + throw Exception("OnFinish"); + } + } + else + { + Memo->Lines->Add("Job 1 Finished: unknown object 'Sender'"); + } } //--------------------------------------------------------------------------- +void __fastcall TForm1::JvThread2Finish(TObject *Sender) +{ + TJvBaseThread* t=dynamic_cast<TJvBaseThread*>(Sender); + if(t) + { + int id=t->ThreadID; + int rv=t->ReturnValue; + TJvThread* Container=dynamic_cast<TJvThread*>(t->Container); + Memo->Lines->Add("Job2 Finished: "+IntToHex(id, 8)+" result: "+IntToStr(rv)); + SJobData* data=(SJobData*)t->Params; + delete data; -void __fastcall TForm1::enableButton1(void) + if(rbExOnFinish->Checked) + { + cbAutoStart2->Checked=false; // for preventing endless exception generation + throw Exception("OnFinish"); + } + } + else + { + Memo->Lines->Add("Finished: unknown object 'Sender'"); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::JvThread1FinishAll(TObject *Sender) { - Button1->Enabled = true; + TJvThread* Container=dynamic_cast<TJvThread*>(Sender); + Memo->Lines->Add("Finished all Job 1"); + if(rbExOnFinishAll->Checked) + { + cbAutoStart1->Checked=false; // for preventing endless exception generation + throw Exception("OnFinishAll"); + } } //--------------------------------------------------------------------------- +void __fastcall TForm1::JvThread2FinishAll(TObject *Sender) +{ + TJvThread* Container=dynamic_cast<TJvThread*>(Sender); + Memo->Lines->Add("Finished all Job 2"); + if(rbExOnFinishAll->Checked) + { + cbAutoStart2->Checked=false; // for preventing endless exception generation + throw Exception("OnFinishAll"); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::MemoDblClick(TObject *Sender) +{ + Memo->Clear(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::tmrStatusTimer(TObject *Sender) +{ + lbCount1->Caption="Job 1 count: "+IntToStr(JvThread1->Count); + lbCount2->Caption="Job 2 count: "+IntToStr(JvThread2->Count); + if(JvThread1->Count==0) lbStats1->Caption = "ID:-------- V:-"; + if(JvThread2->Count==0) lbStats2->Caption = "ID:-------- V:-"; -void __fastcall TForm1::enableButton2(void) + cbJobTerminated1->Checked=JvThread1->Terminated; + cbJobTerminated2->Checked=JvThread2->Terminated; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::tmrAutoTimer(TObject *Sender) { - Button2->Enabled = true; + if(cbAutoStart1->Checked) + { + if(rand()&1) btnStartJob1->Click(); + else btnStartJob1SimpleDlg->Click(); + } + + if(cbAutoStart2->Checked) + { + if(rand()&1) btnStartJob2->Click(); + else btnStartJob2AnimatedDlg->Click(); + } } //--------------------------------------------------------------------------- +void __fastcall TForm1::btnSuspendItselfClick(TObject *Sender) +{ + SuspendRandomThread=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnRaiseExceptionClick(TObject *Sender) +{ + RaiseExceptInThread=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnRemoveZombieClick(TObject *Sender) +{ + JvThread1->RemoveZombie(); + JvThread2->RemoveZombie(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::btnShowStateClick(TObject *Sender) +{ + AnsiString s; + char c; -void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose) -{ - if(!JvThread1->Terminated) + JvThread1->Lock(); // cleaning up threads with FreeOnTerminate=false + try + { + if(JvThread1->Count) { - JvThread1->Terminate(); + Memo->Lines->Add("Job 1 list"); + Memo->Lines->Add("ID Active Finished Return Value"); + for(int i=0; i<JvThread1->Count; ++i) + { + TJvBaseThread* T=JvThread1->Threads[i]; + s=IntToHex((int)T->ThreadID, 8)+" "; + if(T->ExecuteIsActive) c='+'; else c='-'; s+=c; s+=" "; + if(T->Finished) c='+'; else c='-'; s+=c; s+=" "; + s+=IntToStr(T->ReturnValue); + Memo->Lines->Add(s); + } } - if(!JvThread2->Terminated) + else + Memo->Lines->Add("Job 1 list is empty"); + } + __finally + { + JvThread1->Unlock(); + } + + JvThread2->Lock(); // cleaning up threads with FreeOnTerminate=false + try + { + if(JvThread2->Count) { - JvThread2->Terminate(); + Memo->Lines->Add("Job 2 list"); + Memo->Lines->Add("ID Active Finished Return Value"); + for(int i=0; i<JvThread2->Count; ++i) + { + TJvBaseThread* T=JvThread2->Threads[i]; + s=IntToHex((int)T->ThreadID, 8)+" "; + if(T->ExecuteIsActive) c='+'; else c='-'; s+=c; s+=" "; + if(T->Finished) c='+'; else c='-'; s+=c; s+=" "; + s+=IntToStr(T->ReturnValue); + Memo->Lines->Add(s); + } } - while( (!JvThread1->Terminated) && (!JvThread2->Terminated) ) - { - ::Sleep(100); - Application->ProcessMessages(); - } - + else + Memo->Lines->Add("Job 2 list is empty"); + } + __finally + { + JvThread2->Unlock(); + } } //--------------------------------------------------------------------------- Modified: trunk/jvcl/examples/JvThread/BCB/fThread.dfm =================================================================== --- trunk/jvcl/examples/JvThread/BCB/fThread.dfm 2007-06-04 20:27:36 UTC (rev 11311) +++ trunk/jvcl/examples/JvThread/BCB/fThread.dfm 2007-06-04 21:02:57 UTC (rev 11312) @@ -1,8 +1,8 @@ object Form1: TForm1 - Left = 229 - Top = 185 - Width = 726 - Height = 478 + Left = 228 + Top = 125 + Width = 760 + Height = 485 Caption = 'JvThread Demo' Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -11,105 +11,569 @@ Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False + Position = poScreenCenter OnCloseQuery = FormCloseQuery PixelsPerInch = 96 TextHeight = 13 - object Label1: TLabel - Left = 67 - Top = 49 - Width = 50 - Height = 13 - Caption = 'Job1 Stats' - end - object Label2: TLabel - Left = 135 - Top = 49 - Width = 3 - Height = 13 - end - object Label3: TLabel - Left = 67 - Top = 103 - Width = 50 - Height = 13 - Caption = 'Job2 Stats' - end - object Label4: TLabel - Left = 135 - Top = 103 - Width = 3 - Height = 13 - end - object Button1: TButton - Left = 36 - Top = 18 - Width = 75 - Height = 25 - Caption = 'Start Job &1' + object Panel1: TPanel + Left = 0 + Top = 0 + Width = 397 + Height = 458 + Align = alLeft TabOrder = 0 - OnClick = Button1Click + object GroupBox1: TGroupBox + Left = 1 + Top = 1 + Width = 395 + Height = 160 + Align = alTop + Caption = ' Job 1 ' + TabOrder = 0 + object Label2: TLabel + Tag = 1 + Left = 108 + Top = 80 + Width = 51 + Height = 13 + Caption = 'Max Count' + end + object Label4: TLabel + Tag = 1 + Left = 140 + Top = 104 + Width = 31 + Height = 13 + Caption = 'Priority' + end + object Label5: TLabel + Left = 336 + Top = 134 + Width = 53 + Height = 13 + Caption = 'Terminated' + end + object btnStartJob1: TButton + Tag = 1 + Left = 50 + Top = 15 + Width = 85 + Height = 25 + Caption = 'Start Job &1' + TabOrder = 0 + OnClick = btnStartJob1Click + end + object btnStartJob1SimpleDlg: TButton + Tag = 1 + Left = 138 + Top = 15 + Width = 179 + Height = 25 + Caption = 'Start Job 1 with Simple &Dialog' + TabOrder = 1 + OnClick = btnStartJob1SimpleDlgClick + end + object cbExclusive1: TCheckBox + Tag = 1 + Left = 50 + Top = 43 + Width = 121 + Height = 17 + Caption = 'Exclusive execution' + TabOrder = 2 + OnClick = cbExclusive1Click + end + object seMaxCount1: TJvSpinEdit + Tag = 1 + Left = 50 + Top = 76 + Width = 49 + Height = 21 + MaxValue = 100000 + TabOrder = 3 + OnChange = seMaxCount1Change + end + object cbPriority1: TComboBox + Tag = 1 + Left = 50 + Top = 101 + Width = 85 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 4 + OnChange = cbPriority1Change + Items.Strings = ( + 'Idle' + 'Lowest' + 'Lower' + 'Normal' + 'Higher' + 'Highest' + 'TimeCritical') + end + object btnTerminate1: TButton + Tag = 1 + Left = 232 + Top = 128 + Width = 85 + Height = 25 + Caption = 'Terminate' + TabOrder = 5 + OnClick = btnTerminate1Click + end + object cbAutoStart1: TCheckBox + Left = 320 + Top = 20 + Width = 65 + Height = 17 + Caption = 'Autostart' + TabOrder = 6 + end + object btnSuspendAll1: TButton + Left = 50 + Top = 128 + Width = 85 + Height = 25 + Caption = 'Suspend All' + TabOrder = 7 + OnClick = btnSuspendAll1Click + end + object btnResumeAll1: TButton + Left = 140 + Top = 128 + Width = 85 + Height = 25 + Caption = 'Resume All' + TabOrder = 8 + OnClick = btnResumeAll1Click + end + object Panel2: TPanel + Left = 184 + Top = 80 + Width = 133 + Height = 41 + TabOrder = 9 + object lbCount1: TLabel + Tag = 1 + Left = 23 + Top = 6 + Width = 86 + Height = 13 + Alignment = taCenter + Caption = 'Thread Count 1: 0' + end + object lbStats1: TLabel + Tag = 1 + Left = 6 + Top = 21 + Width = 123 + Height = 13 + Alignment = taCenter + AutoSize = False + Caption = 'ID: 00000000 V:0' + end + end + object cbDeferredExecution1: TCheckBox + Left = 184 + Top = 43 + Width = 117 + Height = 17 + Caption = 'Deferred Execution' + TabOrder = 10 + OnClick = cbDeferredExecution1Click + end + object cbJobTerminated1: TCheckBox + Left = 320 + Top = 132 + Width = 14 + Height = 17 + Checked = True + Enabled = False + State = cbChecked + TabOrder = 11 + end + object cbDeferredDeletion1: TCheckBox + Left = 184 + Top = 59 + Width = 117 + Height = 17 + Caption = 'Deferred Deletion' + TabOrder = 12 + OnClick = cbDeferredDeletion1Click + end + end + object GroupBox2: TGroupBox + Left = 1 + Top = 161 + Width = 395 + Height = 160 + Align = alTop + Caption = ' Job 2 ' + TabOrder = 1 + object Label1: TLabel + Tag = 2 + Left = 108 + Top = 80 + Width = 51 + Height = 13 + Caption = 'Max Count' + end + object Label3: TLabel + Tag = 2 + Left = 140 + Top = 104 + Width = 31 + Height = 13 + Caption = 'Priority' + end + object Label7: TLabel + Left = 336 + Top = 134 + Width = 53 + Height = 13 + Caption = 'Terminated' + end + object btnStartJob2: TButton + Tag = 2 + Left = 49 + Top = 15 + Width = 85 + Height = 25 + Caption = 'Start Job &2' + TabOrder = 0 + OnClick = btnStartJob2Click + end + object btnStartJob2AnimatedDlg: TButton + Tag = 2 + Left = 138 + Top = 15 + Width = 178 + Height = 25 + Caption = 'Start Job 2 with Animated D&ialog' + TabOrder = 1 + OnClick = btnStartJob2AnimatedDlgClick + end + object cbExclusive2: TCheckBox + Tag = 2 + Left = 52 + Top = 43 + Width = 121 + Height = 17 + Caption = 'Exclusive execution' + TabOrder = 2 + OnClick = cbExclusive2Click + end + object seMaxCount2: TJvSpinEdit + Tag = 2 + Left = 52 + Top = 76 + Width = 49 + Height = 21 + MaxValue = 100000 + TabOrder = 3 + OnChange = seMaxCount2Change + end + object cbPriority2: TComboBox + Tag = 2 + Left = 52 + Top = 101 + Width = 81 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 4 + OnChange = cbPriority2Change + Items.Strings = ( + 'Idle' + 'Lowest' + 'Lower' + 'Normal' + 'Higher' + 'Highest' + 'TimeCritical') + end + object btnTerminate2: TButton + Tag = 2 + Left = 232 + Top = 128 + Width = 85 + Height = 25 + Caption = 'Terminate' + TabOrder = 5 + OnClick = btnTerminate2Click + end + object cbAutoStart2: TCheckBox + Left = 320 + Top = 20 + Width = 65 + Height = 17 + Caption = 'Autostart' + TabOrder = 6 + end + object btnSuspendAll2: TButton + Left = 50 + Top = 128 + Width = 85 + Height = 25 + Caption = 'Suspend All' + TabOrder = 7 + OnClick = btnSuspendAll2Click + end + object btnResumeAll2: TButton + Left = 140 + Top = 128 + Width = 85 + Height = 25 + Caption = 'Resume All' + TabOrder = 8 + OnClick = btnResumeAll2Click + end + object cbShowMsgBeforeExit2: TCheckBox + Left = 52 + Top = 59 + Width = 129 + Height = 17 + Caption = 'Show Msg Before Exit' + TabOrder = 9 + end + object Panel3: TPanel + Left = 184 + Top = 80 + Width = 133 + Height = 41 + TabOrder = 10 + object lbStats2: TLabel + Tag = 2 + Left = 6 + Top = 21 + Width = 123 + Height = 13 + Alignment = taCenter + AutoSize = False + Caption = 'ID: 00000000 V:0' + end + object lbCount2: TLabel + Tag = 2 + Left = 23 + Top = 6 + Width = 86 + Height = 13 + Alignment = taCenter + Caption = 'Thread Count 2: 0' + end + end + object cbDeferredExecution2: TCheckBox + Left = 184 + Top = 43 + Width = 117 + Height = 17 + Caption = 'Deferred Execution' + TabOrder = 11 + OnClick = cbDeferredExecution2Click + end + object cbJobTerminated2: TCheckBox + Left = 320 + Top = 132 + Width = 14 + Height = 17 + AllowGrayed = True + Checked = True + Enabled = False + State = cbChecked + TabOrder = 12 + end + object cbDeferredDeletion2: TCheckBox + Left = 184 + Top = 59 + Width = 117 + Height = 17 + Caption = 'Deferred Deletion' + TabOrder = 13 + OnClick = cbDeferredDeletion2Click + end + end + object GroupBox3: TGroupBox + Left = 1 + Top = 321 + Width = 395 + Height = 136 + Align = alClient + Caption = ' Additional tests ' + TabOrder = 2 + object rbExOnBegin: TRadioButton + Left = 12 + Top = 33 + Width = 170 + Height = 17 + Caption = 'Exception in '#39'OnBegin'#39 + TabOrder = 0 + end + object rbExOnBeforeResume: TRadioButton + Left = 12 + Top = 50 + Width = 170 + Height = 17 + Caption = 'Exception in '#39'OnBeforeResume'#39 + TabOrder = 1 + end + object rbExOnFinish: TRadioButton + Left = 12 + Top = 67 + Width = 170 + Height = 17 + Caption = 'Exception in '#39'OnFinish'#39 + TabOrder = 2 + end + object rbExOnFinishAll: TRadioButton + Left = 12 + Top = 84 + Width = 170 + Height = 17 + Caption = 'Exception in '#39'OnFinishAll'#39 + TabOrder = 3 + end + object rbNoEx: TRadioButton + Left = 12 + Top = 16 + Width = 170 + Height = 17 + Caption = 'No Exceptions' + Checked = True + TabOrder = 4 + TabStop = True + end + object GroupBox4: TGroupBox + Left = 243 + Top = 8 + Width = 148 + Height = 92 + Anchors = [akTop, akRight] + Caption = ' Action in thread procedure ' + TabOrder = 5 + object Label6: TLabel + Left = 36 + Top = 16 + Width = 77 + Height = 13 + Caption = '(random thread):' + end + object btnSuspendItself: TButton + Left = 29 + Top = 32 + Width = 90 + Height = 25 + Caption = 'Suspend itself' + TabOrder = 0 + OnClick = btnSuspendItselfClick + end + object btnRaiseException: TButton + Left = 29 + Top = 60 + Width = 90 + Height = 25 + Caption = 'Raise exception' + TabOrder = 1 + OnClick = btnRaiseExceptionClick + end + end + object btnShowState: TButton + Left = 273 + Top = 104 + Width = 90 + Height = 25 + Caption = 'Show State' + TabOrder = 6 + OnClick = btnShowStateClick + end + object btnRemoveZombie: TButton + Left = 160 + Top = 104 + Width = 105 + Height = 25 + Caption = 'Remove Zombie' + TabOrder = 7 + OnClick = btnRemoveZombieClick + end + end end - object Button2: TButton - Left = 36 - Top = 69 - Width = 75 - Height = 25 - Caption = 'Start Job &2' + object Memo: TMemo + Left = 397 + Top = 0 + Width = 355 + Height = 458 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Lines.Strings = ( + '(Double click to clear log)') + ParentFont = False + ScrollBars = ssVertical TabOrder = 1 - OnClick = Button2Click + OnDblClick = MemoDblClick end - object Button3: TButton - Left = 121 - Top = 18 - Width = 100 - Height = 25 - Caption = 'Start Job 1 &Dialog' - TabOrder = 2 - OnClick = Button3Click - end - object Button4: TButton - Left = 121 - Top = 69 - Width = 100 - Height = 25 - Caption = 'Start Job 2 D&ialog' - TabOrder = 3 - OnClick = Button4Click - end object JvThread1: TJvThread - Exclusive = True + Exclusive = False + MaxCount = 5 RunOnCreate = True - FreeOnTerminate = False + FreeOnTerminate = True ThreadDialog = JvThreadSimpleDialog1 + BeforeResume = JvThreadBeforeResume + OnBegin = JvThreadBegin OnExecute = JvThread1Execute - Left = 6 - Top = 6 + OnFinish = JvThread1Finish + OnFinishAll = JvThread1FinishAll + Left = 10 + Top = 18 end object JvThread2: TJvThread - Exclusive = True + Exclusive = False + MaxCount = 10 RunOnCreate = True - FreeOnTerminate = False + FreeOnTerminate = True ThreadDialog = JvThreadAnimateDialog1 + BeforeResume = JvThreadBeforeResume + OnBegin = JvThreadBegin OnExecute = JvThread2Execute - Left = 6 - Top = 44 + OnFinish = JvThread2Finish + OnFinishAll = JvThread2FinishAll + Left = 10 + Top = 180 end object JvThreadSimpleDialog1: TJvThreadSimpleDialog + DialogOptions.FormStyle = fsNormal DialogOptions.ShowDialog = True DialogOptions.ShowModal = False + DialogOptions.CancelButtonCaption = 'Cancel' + DialogOptions.Caption = 'Job 1 Simple Dialog ' DialogOptions.InfoText = 'Infotext' - DialogOptions.Caption = '23423423423432' - DialogOptions.CancelButtonCaption = 'Cancel' - Left = 260 - Top = 20 + DialogOptions.ShowProgressBar = True + Left = 340 + Top = 40 end object JvThreadAnimateDialog1: TJvThreadAnimateDialog + DialogOptions.FormStyle = fsNormal DialogOptions.ShowDialog = True + DialogOptions.ShowModal = False + DialogOptions.CancelButtonCaption = 'Cancel' + DialogOptions.Caption = 'Job 2 Animated Dialog ' DialogOptions.InfoText = 'Info' - DialogOptions.Caption = 'Execute Thread' - DialogOptions.CancelButtonCaption = 'Cancel' - DialogOptions.CommonAVI = aviCopyFiles - Left = 255 - Top = 70 + DialogOptions.CommonAVI = aviFindComputer + Left = 339 + Top = 202 end + object tmrStatus: TTimer + Interval = 200 + OnTimer = tmrStatusTimer + Left = 440 + Top = 408 + end + object tmrAuto: TTimer + OnTimer = tmrAutoTimer + Left = 408 + Top = 408 + end end Modified: trunk/jvcl/examples/JvThread/BCB/fThread.h =================================================================== --- trunk/jvcl/examples/JvThread/BCB/fThread.h 2007-06-04 20:27:36 UTC (rev 11311) +++ trunk/jvcl/examples/JvThread/BCB/fThread.h 2007-06-04 21:02:57 UTC (rev 11312) @@ -35,38 +35,118 @@ #include <StdCtrls.hpp> #include <Forms.hpp> #include "JvComponent.hpp" -#include "JvThread.hpp" +#include "D:\Program Files\Borland\CBuilder5\User Components\JVCL\run\JvThread.hpp" +// "JvThread.hpp" #include "JvThreadDialog.hpp" +#include "JvComponentBase.hpp" +#include <ExtCtrls.hpp> +#include "JvExMask.hpp" +#include "JvSpin.hpp" +#include <Mask.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components - TLabel *Label1; - TLabel *Label2; - TLabel *Label3; - TLabel *Label4; - TButton *Button1; - TButton *Button2; - TButton *Button3; - TButton *Button4; + TPanel *Panel1; TJvThread *JvThread1; TJvThread *JvThread2; TJvThreadSimpleDialog *JvThreadSimpleDialog1; TJvThreadAnimateDialog *JvThreadAnimateDialog1; + TTimer *tmrStatus; + TGroupBox *GroupBox1; + TButton *btnStartJob1; + TButton *btnStartJob1SimpleDlg; + TGroupBox *GroupBox2; + TButton *btnStartJob2; + TButton *btnStartJob2AnimatedDlg; + TCheckBox *cbExclusive2; + TJvSpinEdit *seMaxCount2; + TLabel *Label1; + TLabel *Label3; + TComboBox *cbPriority2; + TButton *btnTerminate2; + TCheckBox *cbExclusive1; + TJvSpinEdit *seMaxCount1; + TLabel *Label2; + TLabel *Label4; + TComboBox *cbPriority1; + TButton *btnTerminate1; + TGroupBox *GroupBox3; + TMemo *Memo; + TRadioButton *rbExOnBegin; + TRadioButton *rbExOnBeforeResume; + TRadioButton *rbExOnFinish; + TRadioButton *rbExOnFinishAll; + TRadioButton *rbNoEx; + TCheckBox *cbAutoStart2; + TCheckBox *cbAutoStart1; + TTimer *tmrAuto; + TButton *btnSuspendAll1; + TButton *btnResumeAll1; + TButton *btnSuspendAll2; + TButton *btnResumeAll2; + TCheckBox *cbShowMsgBeforeExit2; + TPanel *Panel2; + TLabel *lbCount1; + TLabel *lbStats1; + TPanel *Panel3; + TLabel *lbStats2; + TLabel *lbCount2; + TCheckBox *cbDeferredExecution2; + TCheckBox *cbDeferredExecution1; + TGroupBox *GroupBox4; + TLabel *Label6; + TButton *btnSuspendItself; + TButton *btnRaiseException; + TCheckBox *cbJobTerminated1; + TCheckBox *cbJobTerminated2; + TLabel *Label5; + TLabel *Label7; + TButton *btnShowState; + TCheckBox *cbDeferredDeletion2; + TCheckBox *cbDeferredDeletion1; + TButton *btnRemoveZombie; void __fastcall JvThread1Execute(TObject *Sender, Pointer Params); void __fastcall JvThread2Execute(TObject *Sender, Pointer Params); - void __fastcall Button1Click(TObject *Sender); - void __fastcall Button2Click(TObject *Sender); - void __fastcall Button3Click(TObject *Sender); - void __fastcall Button4Click(TObject *Sender); + void __fastcall btnStartJob1Click(TObject *Sender); + void __fastcall btnStartJob2Click(TObject *Sender); + void __fastcall btnStartJob1SimpleDlgClick(TObject *Sender); + void __fastcall btnStartJob2AnimatedDlgClick(TObject *Sender); void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose); + void __fastcall JvThreadBeforeResume(TObject *Sender); + void __fastcall JvThread2Finish(TObject *Sender); + void __fastcall JvThread2FinishAll(TObject *Sender); + void __fastcall MemoDblClick(TObject *Sender); + void __fastcall btnTerminate2Click(TObject *Sender); + void __fastcall cbExclusive1Click(TObject *Sender); + void __fastcall tmrStatusTimer(TObject *Sender); + void __fastcall cbPriority2Change(TObject *Sender); + void __fastcall cbExclusive2Click(TObject *Sender); + void __fastcall seMaxCount2Change(TObject *Sender); + void __fastcall seMaxCount1Change(TObject *Sender); + void __fastcall cbPriority1Change(TObject *Sender); + void __fastcall btnTerminate1Click(TObject *Sender); + void __fastcall JvThreadBegin(TObject *Sender); + void __fastcall JvThread1Finish(TObject *Sender); + void __fastcall JvThread1FinishAll(TObject *Sender); + void __fastcall tmrAutoTimer(TObject *Sender); + void __fastcall btnSuspendAll1Click(TObject *Sender); + void __fastcall btnResumeAll1Click(TObject *Sender); + void __fastcall btnSuspendAll2Click(TObject *Sender); + void __fastcall btnResumeAll2Click(TObject *Sender); + void __fastcall btnRaiseExceptionClick(TObject *Sender); + void __fastcall cbDeferredExecution1Click(TObject *Sender); + void __fastcall cbDeferredExecution2Click(TObject *Sender); + void __fastcall btnSuspendItselfClick(TObject *Sender); + void __fastcall btnShowStateClick(TObject *Sender); + void __fastcall cbDeferredDeletion1Click(TObject *Sender); + void __fastcall cbDeferredDeletion2Click(TObject *Sender); + void __fastcall btnRemoveZombieClick(TObject *Sender); private: // User declarations protected: - void __fastcall enableButton1(void); - void __fastcall enableButton2(void); public: // User declarations - int Value; - int Value2; + int ThreadID1, Value1; + int ThreadID2, Value2; __fastcall TForm1(TComponent* Owner); void __fastcall Stats1(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |