[fpc-devel] threads questions

Mario R. Carro mcarro at gmx.net
Wed May 30 17:28:54 CEST 2007

Hi, I have some (dumb) questions regarding threads. I'm sure that this issues 
have been discussed before but I couldn't find any information...

- The attr parameter of the pthreads_cond_init fc (and others) on linux is is 
declared as a var parameter, not as a pointer, but it should be a pointer 
because nil is a valid parameter value. On the other hand, the pthreads unit 
compiled for SunOS and BSD do declare the attr parameter as a pointer, so fpc 
code using pthreads on linux is not portable to other unixes (compare de 
pthr*.inc files). Which version is considered right? (I would prefer the 
pointers one, because it would save me declaring many useless variables).

- The std unix error constants (for example EBUSY) are declared in errnoh.inc 
that is only included by the unit libc. But I believe to remember that the 
unit libc is considered deprecated (only for Kylix compatibility and not to 
be used by new projects) isn't it? So, which is the preferred way of getting 
EBUSY et al. declared: (a) use libc anyway, (b) include errnoh.inc, (c) 
declare it the project code?

- The pthreads unit does not declare pthread_t, It exists in unixtype but 
unixtype redefines also some other types that are already defined in 
pthreads, causing compilation errors if included in the "wrong" order. 
Shouldn't pthreads define pthread_t?


More information about the fpc-devel mailing list