Are there any plans for Linux to add higher-level things like Windows' WaitForMultipleObjects?
-2
votes
1
answer
323
views
WaitForMultipleObjects is one of several Windows kernel functions that can suspend and synchronize a calling thread with other threads until resources or etc are available, similar to flock in Linux, but handles everything but file locking.
WaitForMultipleObjects supports an array of events (can be a mixture of change notifications, console input, events, memory notifications, mutexes, processes, semaphores, threads, and timers), a timeout or polling option, and an AND/OR option and reports which fired first, and it can be used independently by multiple threads at once without knowledge of each other.
(I was looking for an IPC lock with timeout and things like using SIGALRM with flock where suggested which I can't risk using because SIGALRM might be in use in other multi-threaded libraries I don't have source to. I settled on using polling with LOCK_NB and tiny sleeps, and I am pretty sure I am not losing any "fair lock" benefits.)
Asked by Codemeister
(1 rep)
Jan 9, 2022, 06:13 PM
Last activity: Aug 19, 2023, 09:41 AM
Last activity: Aug 19, 2023, 09:41 AM