Forum > Operating Systems
Wait for multiple events
marcov:
Flowcrane: such workarounds are not for all scenarios.
waitformultiple can also exit if one is signaled, and then you can process that one, and block on the remaining ones, enabling more parallelism.
Maybe the ntsync kernel module or futex_waitv will finally enable something comparable for Linux. However till now those seem mostly meant for Windows emulation (read "wine"), not general purpose app use.
flowCRANE:
--- Quote from: marcov on February 20, 2025, 02:12:16 pm ---Flowcrane: such workarounds are not for all scenarios.
--- End quote ---
Of course but, there is no one universal answer to this question. You can wait for multiple signals without using anything fancy, like in the scenario my test program implements. In other scenarios, this won't be an option. To be able to provide specific advice, one would need to know the exact context, and the OP did not describe this.
Who knows what he need to implement. Maybe my test program will be useful to him, or maybe to someone else. In any case, in order to give any sensible advice, the OP needs to provide more information about what exactly he wants to achieve.
alpine:
--- Quote from: flowCRANE on February 20, 2025, 06:57:00 pm ---
--- Quote from: marcov on February 20, 2025, 02:12:16 pm ---Flowcrane: such workarounds are not for all scenarios.
--- End quote ---
Of course but, there is no one universal answer to this question. You can wait for multiple signals without using anything fancy, like in the scenario my test program implements. In other scenarios, this won't be an option. To be able to provide specific advice, one would need to know the exact context, and the OP did not describe this.
Who knows what he need to implement. Maybe my test program will be useful to him, or maybe to someone else. In any case, in order to give any sensible advice, the OP needs to provide more information about what exactly he wants to achieve.
--- End quote ---
I apologise for not being so specific, the use case was the one that resembles the select semantics, as marcov suggests. Not so trivial as the one for waiting all events set. The question was for a portable way to do this.
Anyway, I appreciate the help.
Navigation
[0] Message Index
[*] Previous page