Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-10

using eventfd

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andreas Klausmann

Hi,

which unit(s) do I have to include to use eventfd() under Linux?

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

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

Best regards

Andreas

Henry Vermaak
to Andreas Klausmann
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.

Henry