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

Graeme Geldenhuys graeme at geldenhuys.co.uk
Thu Feb 7 09:46:32 CET 2013


On 2013-02-06 20:17, Sven Barth wrote:
> 
> If you just define your own semaphore class that contains the platform
> specific types and lock and unlock methods then you only need to add an
> additional "array[0..4] of Longint" after the "sem_t" field for FreeBSD.
> Then you should be okay.

Yes that will work, but it simply moves the problems or IFDEF's to a
different location.


> You need to use at least synchronisation primitives like mutexes otherwise
> it won't be threadsafe.

Yes, that is what I am planning. The class I am working with is a Thread
Pool, so thread safety is a given. ;-)
At least I don't need cross-process semaphore support, only multiple
threads in the same process. So this makes things a lot easier.

Regards,
  - Graeme -

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




More information about the fpc-devel mailing list