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;

Whereas a quick google search got me here:

http://svnweb.freebsd.org/base/head/include/semaphore.h?revision=201546&view=markup

Which says sem_t should be:

struct _sem {
        __uint32_t _magic;
        struct _usem _kern;
};

This would explain your variable getting overwritten, I think.

Henry
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to