On 16.09.2013 23:13, Mario R. Carro wrote:
Hello all.

In it's current form (r23227) CurrentThreadVar it's not initialized
before calling Execute in the TThread implementation for Linux (Unix).

Due to this the calls to TThread.CurrentThread always returns references
to TExternalThread instances, guessing that the current thread is not a
FPC thread (due to CurrentThreadVar being nil), even for actual TThread
threads.

Adding the line:

     CurrentThreadVar := LThread;

somewhere before calling Execute in ThreadFunc in rtl/unix/tthread.inc
solves this problem.

Why the hell does the Unix implementation use a different thread function which does the same in the end?! O.o
Please create a bug report.

Also: the TExternalThread instances created by TThread.CurrentThread are
never freed, and so effectively leaked, isn't it?

They are freed at the end of the program.

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to