[fpc-devel] CThreads.pp

Tomas Hajny XHajT03 at hajny.biz
Sat Nov 17 12:12:07 CET 2012


On 16 Nov 12, at 13:19, Jonas Maebe wrote:
> On 15 Nov 2012, at 19:55, Ewald wrote:
> 
> > I'll start off with some strange things first:
> >
> >    - In the source code of CThreads.pp there appears to be no field in
> >    the threadmanager record called `rtlEventSync`. Yet the compiler
> >    complains about the fact that this field is missing in my
> >    declaration of the TThreadManager record. This declaration looks as
> >    follows: `Const ZThreadManager = TThreadManager = (field: value;
> >    ........);`.
> 
> Cthreads initialzes the thread manager record by explicitly assigning  
> the thread manager record fields, not by declaring a typed constant.  
> That means the compiler does not check for uninitialized fields. It  
> seems this routine indeed still needs to be implemented for Unix  
> platforms.
 .
 .

Not only that - it doesn't seem to be implemented for any of our 
platforms as far as I can see (at least neither Windows nor Unix nor 
OS/2). Our documentation says that it is obsolete and it should not 
be used. Considering this, we should probably remove it immediately 
because anyone trying to use it gets an immediate SIGSEGV due to 
uninitialized (nil) pointer (unless he uses his own thread manager, 
of course). If there are some reasons for keeping the parameter, we 
should at least modify the common RtlEventSync implementation in 
thread.inc to check for the nil value first and either do nothing or 
generate some more friendly error message.

Tomas




More information about the fpc-devel mailing list