|
|
1.1 ! root 1: //--------------------------------------------------------------------------- ! 2: #include <stdio.h> /* printf */ ! 3: #pragma hdrstop ! 4: ! 5: #include "TestThreadUnit.h" ! 6: #pragma package(smart_init) ! 7: //--------------------------------------------------------------------------- ! 8: __fastcall TTestThread::TTestThread(bool CreateSuspended) ! 9: : TThread(CreateSuspended) ! 10: { ! 11: ChildEvent = new TSimpleEvent(); ! 12: ParentEvent = new TSimpleEvent(); ! 13: } ! 14: //--------------------------------------------------------------------------- ! 15: void __fastcall TTestThread::Execute() ! 16: { ! 17: printf("TestThread::Execute() entry\n"); ! 18: ChildEvent->SetEvent(); ! 19: ! 20: for(int i=0;i<10;i++) { ! 21: ParentEvent->WaitFor(INFINITE); ! 22: ParentEvent->ResetEvent(); ! 23: printf(" <child>\n"); ! 24: ChildEvent->SetEvent(); ! 25: } ! 26: ! 27: printf("thread_test exit\n"); ! 28: } ! 29: //--------------------------------------------------------------------------- ! 30:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.