[fpc-devel] Threading support and C library under Linux/Unix

Michael Schnell mschnell at lumino.de
Wed Jun 23 15:16:40 CEST 2010


On 06/23/2010 03:08 PM, Henry Vermaak wrote:
> A futex syscall doesn't know anything about threads, it's for locking.
>  Perhaps I'm misunderstanding you?
>   
The Futex syscall does not lock a Mutex at all. It's a helper for the
user space locking action and performs the putting a thread to sleep
(called by userspace, if userspace detects that the Mutex to be locked
is already taken) and waking up a thread (called by userspace if
userspace detects that a thread is waiting on the Mutex it is about to
unlock) and moreover the Futex syscall takes care that the system can do
some housekeeping in case a thread dies that still has a lock.

The user space stuff is usually done in a library (such as pthread lib
in libc. But of course it can be done natively the FPC RTL, as well.

-Michael



More information about the fpc-devel mailing list