Ross,
 
Creating them internally to the thread would certainly be a safer way of handling it though, unless there is a very good reason that you need them to be external. You could still set the properties at design time by putting the components into a data module which isn't auto-created and then have each thread create an instance of the datamodule as required. That would pretty much avoid a, b, c and d from Trevor's very useful list of potential problems.
 
David.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Ross Levis
Sent: Thursday, 16 October 2003 2:19 PM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Threads again

Thanks for the details Trevor.  I think I'll give it a go.
 
Cheers,
Ross.
----- Original Message -----
Sent: Thursday, October 16, 2003 2:01 PM
Subject: Re: [DUG]: Threads again

Ross,
  My experience with components and threads is that you should be able to use the Indy Component within your thread without calling synchronize provided:
 
  a) you manage form destruction well, so that the component can't be destroyed while the thread is working with it.
  b) you do not have any event handlers in the component that call methods on the form (This is a great way to make things go BANG).
  c) there is no other code in the form which works with the Indy Component; it must all live within the thread.
  d) there is no code in the component which references its owner while the thread is fiddling with it.
  e) the component itself does not rely on non-threadsafe behaviour.
 
I haven't done a lot with Indy in threads so I don't know how safe it is going to be to use, but I have done a whole bunch with IBX in threads and the results have been great.
 
HTH
 
Trevor
----- Original Message -----
From: Ross Levis
Sent: Thursday, October 16, 2003 1:13 PM
Subject: [DUG]: Threads again

(D5) I currently have a thread which is updating a text file.  I'm wanting to alter it to optionally send the file to an ftp server once it's created.  I've written to ftp servers before using Indy.
 
I need to put the Indy component on a form, so if I put it on the mainform, can I use it in the thread without using Synchronize?.  Or is Indy quite responsive and would not slow down the main thread by using Synchronize?
 
Any ideas?
 
Regards,
Ross Levis.

Reply via email to