multithreading - Accessing to from from thread -


i have little problem multithreading. use createthread create own thread , create when program starts (sorry @ moment cant use vcl threads). thread working vcl form. program life second thread life too. here 1 problem. when vcl form going terminate thread can check form (class) params. sure when main form terminated , thread try check methods in form... got access violation.

how can secured check params in vcl form? thanks!

here code.

unsigned int winapi checkmutex( lpvoid lpparam ) {     const int def = 20;     int cnt = def;     unicodestring text;     while (1)     {         if (!updfrm || !updfrm->label8 || updfrm->mutexterminate)             break; 

first im checking pointer updfrm vcl form can terminated pointer form still alive. thats why check controls existing. , after check mutexterminate

but here 1 problem. when vcl form going terminate thread can check form (class) params

don't this, reason have found. not access directly form instance vars secondary worker threads.

if have communicate gui-thread vcl components, or tform descendant instance vars, via windows messages, preferably postmessaged form.

the other way round issue ensure secondary thread terminated before form instance freed. lead maze of twisty little deadlocks, alike :(


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -