sunemangs
asked on
Create process ..
I have a TList full of objects (http-components, including TMemoryStreams) that I want to free. The problem is that it takes too long time. Therefore I would like to create a new process that handles this in the background. Does anyone have some code for this.
ASKER
Well, I tied that and it didn’t help. Isn’t it possible to create a process/thread (with CreateProcess) that runs parallel with the rest of the code ?
hi sunemangs,
it should be possible to create a thread-object,
which will do the rest.
meikl
it should be possible to create a thread-object,
which will do the rest.
meikl
Hi guys, another process couldn't free the stuff, since it would have no access to the objects. But another thread could do the work. Look at the TThread object. But be careful! If you change the TList object in the new thread AND in the main thread, you can get problems! Then you should synchronize your actions, e.g. with CriticalSections. (TCriticalSection).
Regards, Madshi.
Regards, Madshi.
ASKER
Does anyone have any code regarding the tread solution?
(I haven’t used threads before)
(I haven’t used threads before)
Look at the thread demo in the Delphi Demos directory
Edo
Edo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much
/Regards
Sune
/Regards
Sune
what does you mean with
>I would like to create a new process that handles this in the background
if you mean to start an other app,
then i don't think that this is possible
does it help, when you include
application.processmessage
in your freeing loop?
meikl