Working with threads

Thread Solved
Reply

Join Date: Jul 2009
Posts: 7
Reputation: Sub Xero is an unknown quantity at this point 
Solved Threads: 2
Sub Xero Sub Xero is offline Offline
Newbie Poster

Working with threads

 
0
  #1
Jul 1st, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: Sub Xero is an unknown quantity at this point 
Solved Threads: 2
Sub Xero Sub Xero is offline Offline
Newbie Poster

Re: Working with threads

 
0
  #2
Jul 8th, 2009
Found the answer myself. And it's yes, I do need to call Synchronize() or the program hangs at random points.

Sub Xero
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 3
Reputation: coderdan is an unknown quantity at this point 
Solved Threads: 0
coderdan coderdan is offline Offline
Newbie Poster

Re: Working with threads

 
0
  #3
Jul 24th, 2009
Originally Posted by Sub Xero View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: Sub Xero is an unknown quantity at this point 
Solved Threads: 2
Sub Xero Sub Xero is offline Offline
Newbie Poster

Re: Working with threads

 
0
  #4
Jul 27th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC