943,597 Members | Top Members by Rank

Ad:
Jul 1st, 2009
0

Working with threads

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 2
Newbie Poster
Sub Xero is offline Offline
7 posts
since Jul 2009
Jul 8th, 2009
0

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
Reputation Points: 10
Solved Threads: 2
Newbie Poster
Sub Xero is offline Offline
7 posts
since Jul 2009
Jul 24th, 2009
0

Re: Working with threads

Click to Expand / Collapse  Quote originally posted by Sub Xero ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
coderdan is offline Offline
3 posts
since Apr 2005
Jul 27th, 2009
0

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
Reputation Points: 10
Solved Threads: 2
Newbie Poster
Sub Xero is offline Offline
7 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: GetDiskSerial
Next Thread in Pascal and Delphi Forum Timeline: Integration





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC