NadavRub
NadavRub

Reputation: 2610

Linux, C++, Waiting for an event using poll/select ( w/o blocking the executing thread )

Use-case

Problem at hand

I don;t want to create a specialized thread to wait for a timeout, and thus, I want to use poll to wait for a timeout on the waitable object in an ~Async~ fashion.

Is it possible to get notified for a mutex wait timeout using poll?

Main thread Pseudo code

Upvotes: 2

Views: 2235

Answers (1)

CL.
CL.

Reputation: 180060

Pthread mutexes do not have a file handle.

Implement your own mutex on top of eventfd, then you can wait for it with poll().

Upvotes: 3

Related Questions