Hallo,
ich habe ein ganz komisches Verhalten bei meinen Threads. Eigentlich sollte beim Beenden eine Funktion durchlaufen werden, welche ich auch dem OnTerminate-Event zugeordnet habe, aber die Funktionen werden bei keinem Thread aufgerufen. Hat jemand einen Tipp?
Michael
Hier ein paar Auszüge:
MyThread = new TMyThread(true); MyThread->FreeOnTerminate = true; MyThread->OnTerminate = MyFunc; MyThread->Priority = tpNormal; MyThread->Resume();
. . .
MyThread->Terminate();
...
void __fastcall MyThread::Execute() { while(!Terminated) { sleep(1); }
...
}
void __fastcall Form1::MyFunc (TObject* Sender) { Counter--; Beep(); // :-) }
Was mache ich falsch? Michael
ich habe ein ganz komisches Verhalten bei meinen Threads. Eigentlich sollte beim Beenden eine Funktion durchlaufen werden, welche ich auch dem OnTerminate-Event zugeordnet habe, aber die Funktionen werden bei keinem Thread aufgerufen. Hat jemand einen Tipp?
Michael
Hier ein paar Auszüge:
MyThread = new TMyThread(true); MyThread->FreeOnTerminate = true; MyThread->OnTerminate = MyFunc; MyThread->Priority = tpNormal; MyThread->Resume();
. . .
MyThread->Terminate();
...
void __fastcall MyThread::Execute() { while(!Terminated) { sleep(1); }
...
}
void __fastcall Form1::MyFunc (TObject* Sender) { Counter--; Beep(); // :-) }
Was mache ich falsch? Michael
Comment