[fpc-pascal] cthreads

Fabio Luis Girardi fluisgirardi at gmail.com
Fri Jul 25 15:04:39 CEST 2014

The same question that I posted on bugtracker:

Linux, BSD, Unix, has another threaddriver than cthreads? If no, why not
make cthreads unit the default threaddriver for Unix?

2014-07-25 7:33 GMT-03:00 Michael Van Canneyt <michael at freepascal.org>:

> On Fri, 25 Jul 2014, Mark Morgan Lloyd wrote:
>  Michael Van Canneyt wrote:
>>> On Fri, 25 Jul 2014, Juha Manninen wrote:
>>>  I was asked why a threaded application compiles on Linux without "uses
>>>> cthreads" but it does not work.
>>>> cthreads must _always_ be added to uses section.
>>>> I had no answer to that. IMO such errors should be trapped at
>>>> compile-time, not at run-time.
>>>> Could it be fixed somehow?
>>> No, because there is no way to detect that threads are actually used in
>>> the program.
>>  I will add a remark in the classes unit TThread class documentation, to
>>> make it even more obvious.
>> Is there scope for improving the error message?
>> Is there a scenario in which a program that sometimes uses threads (e.g.
>> if it realises it's being asked to do a big job which can be parallelised)
>> could start without giving the error message? This would make the situation
>> more serious, since it would require that the programmer did some /real/
>> testing before shipping his code :-)
> Not sure what you mean.
> The error only appears if you call a function that relies on the threading
> manager, never at the start of the program. It's slightly more complicated
> than this, but it boils down to that.
> So the fact that the program started doesn't mean there won't be an error
> further down the line. But that is IMHO no different from many other
> programming errors, such as trying to save preferences in a file in a
> directory that doesn't exist. You should always test all cases.
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

The best regards,

Fabio Luis Girardi
PascalSCADA Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140725/61018d71/attachment.html>

More information about the fpc-pascal mailing list