[fpc-devel] Why FreeBSD sem_init() works different to Linux?
Sven Barth
pascaldragon at googlemail.com
Mon Feb 4 14:52:18 CET 2013
Am 04.02.2013 14:03, schrieb Graeme Geldenhuys:
> On 2013-02-04 12:22, Sven Barth wrote:
>> I have an idea. But for this I'd need some confirmation: Can you please
>> put in your example program the FSemaphore into a record and add also a
>> ...
> OK, attached is the new test project. Below is the output.
>
> Now the FMaxPoolSize variable still has the correct value before and
> after sem_init(), and I could successfully unlock the semaphores. But as
> you can see, the array values have changed.
Exactly as I thought. The reason is - as Henry already wrote - the
incorrect declaration of sem_t. I had already started a discussion about
this on core after I had investigated your original problem, because I
thought that this could lead to problems. The way sem_t is currently
declared is the way it was declared in the C headers of FreeBSD 7.
So currently you can only be safe by putting an "array[0..3] of LongInt"
(4 * 4 Byte to be on the safe side) after the declaration of FSemaphore
in your class. Even if a fix is made in trunk it won't be likely to make
it into 2.6.2 though as that is currently already prepared for release... :(
Could you please report this together with the adjusted test program as
a bug, so it's definitely not forgotten? (and you can mark this at least
as "major")
Regards,
Sven
More information about the fpc-devel
mailing list