[fpc-devel] CSuspendThread/CResumeThread

Michael Van Canneyt michael at freepascal.org
Wed Nov 8 21:48:21 CET 2006



On Wed, 8 Nov 2006, Ales Katona wrote:

>
> > Just define an opaque type TThreadResult:
> >
> >  TThreadResult = DWord // Windows
> >
> >  TThreadResult = cInt  // Unices
> >
> I don't like this solution for several reasons:
>
> 1. What if one OS has more backends for threading available, which
> differ in this?

Good question :-)

But we can easily decide that this is not allowed; On Unix cInt
is the regular type for error codes, so I don't see why anyone
in his right mind would want to do something else.

> 2. How are we going to handle error states on cross-platform
> TThreadManager using code?

You can't do this reliable anyway IMHO. You would need a huge table
with error conditions and do some kind of mapping on 'known values'.

Apart from the difficulty in coding this, do you know all error
conditions and codes for all platforms ? Are they all documented ?
I don't think so...

I don't see an easy way out, short of using exceptions, which are hard to
do in a threading context.

Michael.



More information about the fpc-devel mailing list