Link to home
Start Free TrialLog in
Avatar of sunemangs
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.
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi sunemangs,

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.processmessages
in your freeing loop?

meikl
Avatar of sunemangs
sunemangs

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
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.
Does anyone have any code regarding the tread solution?
(I haven’t used threads before)
Look at the thread demo in the Delphi Demos directory

Edo
ASKER CERTIFIED SOLUTION
Avatar of simonet
simonet
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much

/Regards

Sune