Write a simplest multi-thread with BCB

zhaozj2021-02-08  242

Here is the simplest multi-threaded applet written with BCB

//.CPP thread description _fastcall tmythread :: Tmythread (void): tthread (true) {freeOnterminate = true; resume ();}

// Declaration thread void __fastcall tmythread :: execute () // thread function {for (int i = 1; i <4; i ) Form1-> memo1-> text = form1-> memo1-> text INTOSTR (i) "I get the parameters - my thread / r / n";} void __fastcall tform1 :: button2click (TOBJECT * Sender) // Exercise {Mythread = New Tmythread (); mythread-> freeOnterminate = true;}

/ 类 类 定 声 声;;;;;;;;;;;;;;;;;;;;;;;;

/ / Can join TMYTHREAD * mythread; // declare a thread in the .h form class definition.

This is a simple multi-threaded program

转载请注明原文地址:https://www.9cbs.com/read-2841.html

New Post(0)