[fpc-devel] Why FreeBSD sem_init() works different to Linux?

Marco van de Voort marcov at stack.nl
Mon Feb 4 15:08:29 CET 2013


In our previous episode, Henry Vermaak said:
> > === code begin ===
> > 
> > sem_t_rec = record end;
> > sem_t = ^sem_t_rec;
> > 
> > === code end ===
> 
> Indeed, but trunk pthread.inc looks different from this:
> 
> sem_t = record
> 	magic   : cuint32;
> 	lock    : pthread_mutex_t;
> 	gtzero  : pthread_cond_t;
> 	count   : cuint32;
> 	nwaiters: cuint32;
> 	semid   : semid_t;
> 	sysse   : cint;
> 	entry   : psem_t;
> 	backpointer : ppsem_t;
> 	spare : array[0..SEM_SAFE] of char;
> end;
> 
> Since the definition of TSemaphore is in this file, this definition will
> be used?

For the threadmanager it will be yes. Since the $i pthreads.inc  is after
the unixtype include in cthreads.



More information about the fpc-devel mailing list