Am 04.02.2013 15:02, schrieb Henry Vermaak:
On Mon, Feb 04, 2013 at 02:54:10PM +0100, Sven Barth wrote:
Am 04.02.2013 13:40, schrieb Henry Vermaak:
On Mon, Feb 04, 2013 at 11:47:48AM +0000, Graeme Geldenhuys wrote:
Hi,
I found another problem with Semaphores between FreeBSD and Linux.
Attached is my test project. Again, it is similar code used in tiOPF.
For some reason under FreeBSD, it *always* zeros the variable that holds
the Max Pool Size value passed in to sem_init()'s third parameter. This
means that if I try and us that variable anywhere after the sem_init()
call, like when I want to destroy the semaphore, I can't because the
variable now holds the value 0.
FPC's definition of the semaphore struct is probably wrong for FreeBSD.
Currently, it's:
sem_t = cint;
You are in so far right that the declaration is incorrect, but in
trunk it looks like this:
=== 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?
The rtl/freebsd/pthread.inc is only used in the implementation section
of rtl/unix/cthreads.pp. And if we fix the sem_t type then this
declaration can be removed again (it will then use UnixType.sem_t which
is located in rtl/inc/ptypes.inc).
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel