DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Pascal and Delphi (http://www.daniweb.com/forums/forum124.html)
-   -   Working with threads (http://www.daniweb.com/forums/thread200839.html)

Sub Xero Jul 1st, 2009 3:22 am
Working with threads
 
Hello everyone,
I'm quite familiar with Delphi, but I'm new to using threads and so I've got a question. Here's what I'm trying to do:
I'm using the brilliant VirtualTreeView component and I wish to add to it from a thread. The tree is on the main form and is not visible and the only thing that accesses this tree is the thread.
My understanding is that to access anything on the form I should use Synchronize(), but since the thread is the only thing that uses the component, do I still need this procedure?

Sub Xero

Sub Xero Jul 8th, 2009 6:28 pm
Re: Working with threads
 
Found the answer myself. And it's yes, I do need to call Synchronize() or the program hangs at random points.

Sub Xero

coderdan Jul 24th, 2009 6:15 pm
Re: Working with threads
 
Quote:

Originally Posted by Sub Xero (Post 912138)
Found the answer myself. And it's yes, I do need to call Synchronize() or the program hangs at random points.

Sub Xero


Honestly,

TMultiReadExclusiveWriteSynchronizer is MUCH better than Syncronize. Makes better use of memory and thread execution will stand much less of a chance of hanging.

Cheers

Sub Xero Jul 27th, 2009 1:26 am
Re: Working with threads
 
Hey man, thanks for the info I'll look into that. At the moment the Synchronize function is the main cause of slow down in my application, but until I'm confident that what I'm doing is correct, it's the safest option. So hopefully this may be a better solution.

Sub Xero


All times are GMT -4. The time now is 11:00 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC