[fpc-pascal] using eventfd

Henry Vermaak henry.vermaak at gmail.com
Thu Oct 22 12:40:29 CEST 2015

On Wed, Oct 21, 2015 at 06:43:41PM +0200, Andreas Klausmann wrote:
> Hi,
> which unit(s) do I have to include to use eventfd() under Linux?

I don't think anyone has added it to the linux unit, unfortunately.
You'll have to call it directly with Do_SysCall() in unit syscall.

> Is this function used internally by TEvent? Or where does TEvent end up on
> Linux level to create the event handle?

TEvent uses a mutex and a condition variable from pthreads on unix.

> I'm looking for a way to wait for >=2 events without polling. A thread
> should yield until one of them has been set.

eventfd() is nice and lightweight, but if you don't have an incredibly
low latency requirement, you can use pipes to accomplish the same thing,
with the benefit that you'll be portable to other Unix OS'es.


More information about the fpc-pascal mailing list