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

Graeme Geldenhuys graeme at geldenhuys.co.uk
Mon Feb 4 14:03:00 CET 2013


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.

--------[ freebsd output ]--------------
$ ./project1
FMaxPoolSize before = 2
FValues[0] = $123456
FValues[1] = $654321
FMaxPoolSize after = 2
FValues[0] = $000002
FValues[1] = $000000
c = 2
Now create a lock
c = 1
Now create a lock
c = 0
i = 0
unlock a semaphore
i = 1
unlock a semaphore
i = 2

----------------------------------------


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: semp_test2.tar.gz
Type: application/x-gzip
Size: 1727 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130204/856449aa/attachment.bin>


More information about the fpc-devel mailing list