pascaldragon at googlemail.com
Sun Jul 27 20:52:14 CEST 2014
On 27.07.2014 17:01, Henry Vermaak wrote:
> On Sun, Jul 27, 2014 at 02:39:58PM +0200, Sven Barth wrote:
>> On 27.07.2014 11:39, Mark Morgan Lloyd wrote:
>>> Sven Barth wrote:
>>>> On 26.07.2014 19:50, leledumbo wrote:
>>>>>> Because then all apps are linked to it, also the ones that don't need
>>>>> threads. Same for clocale and cwstrings.
>>>>> If the widestring manager could be made by ourselves, is it possible for
>>>>> thread manager as well?
>>>> Principiall yes, but the problem here would be external code that the
>>>> program links to. E.g. Wine did something like this some time ago
>>>> (before they switched to pthreads) and needed to simulate some
>>>> structures so that libc switches to multithreaded mode... So if we
>>>> have Pascal only code (like the compiler) this would work without big
>>>> problems (if someone implements it of course ;) ), but if you have 3rd
>>>> party code not written in FPC then problems might arise...
>>> On the other hand, if somebody's linking in "alien" code then he should
>>> make himself aware of aware of the prerequisites, particularly since the
>>> threads are more likely to be in the main program (i.e. stuff that he's
>>> written) than in the library he's pulling in.
>> That's not true. E.g. the Qt libraries happily create threads for various
>> background stuffs.
> Ha, I had a library that started a thread and it took me ages to figure
> out why my pascal program was crashing on callbacks from external
> threads. I had to start a dummy thread right at the start of the
> program, even though I included cthreads. Not a good experience all in
Yes, the FPC RTL is normally running in singlethreaded mode and at least
one FPC thread (besides the main one) needs to be started to switch it
in multithreaded mode. I thought that we had some improvements there at
least in 2.7.1, but I'd need to check that again.
More information about the fpc-pascal