[fpc-pascal] Re: Multi-threaded project with few locks (no Thread.waitfor). Memory consumption keeps increasing on Ubuntu 10.10 x64
Vinzent Höfler
JeLlyFish.software at gmx.net
Sat Oct 16 18:25:30 CEST 2010
On Sat, 16 Oct 2010 18:04:59 +0200, Luca Olivetti <luca at ventoso.org> wrote:
> I use that only for threads I start at the beginning of the app and
> terminate at the end, so polling isn't a big issue.
Those kind of threads are not a big issue at all. As they are running
during the whole application's lifetime, race conditions with
concurrently running code are about as improbable as the universe
collapsing right now.
> It's not strictly necessary since the OS will clean up everything
> afterwards, but I prefer to do things properly.
And not call pthread_cancel() like the C++ class you given as example
and stop threads in the middle of their work? ;)
They don't even bother and create all threads in detached state, so
you can not pthread_join() and get an exitcode from them.
>>> while not FFinished do
>>> CheckSynchronize(100);
>>
>> Check again. You can't even access FFinished from a foreign thread.
>
> I can (FFinished is a private member defined by me, and Destroy, being a
> method of the same class, can access private members).
Yes, my mistake. I misinterpreted the lines.
Vinzent.
More information about the fpc-pascal
mailing list