Interrupt poll(...)
Posted: Thu Jul 16, 2020 4:20 pm
The Problem:
I have a system with multiple tasks and one of the tasks performs a poll on a socket. One of the other tasks needs to be able to stop the poll operation.
What I've tried
What I would normally consider is to create an unnamed pipe and add an additional file descriptor to the poll call and set the new descriptor to that or the input stream of the pipe. When I wanted to kill the poll process I would just write to the stream which would cause poll to terminate.
I have coded up my solution and got everything compiling but the link is failing with an undefined symbol pipe.
Is pipe supported ? If it is then what magic do I need to weave to get the method linked into my code?
Alternatives
I'm not tied to this as a solution, all I really need to do is kill the poll operation. I'm happy to kill the task making the poll call so long as I am not going to be leaving resources used when the task is deleted.
Any thoughts on how I can resolve this?
Thanks in advance,
Mark
I have a system with multiple tasks and one of the tasks performs a poll on a socket. One of the other tasks needs to be able to stop the poll operation.
What I've tried
What I would normally consider is to create an unnamed pipe and add an additional file descriptor to the poll call and set the new descriptor to that or the input stream of the pipe. When I wanted to kill the poll process I would just write to the stream which would cause poll to terminate.
I have coded up my solution and got everything compiling but the link is failing with an undefined symbol pipe.
Is pipe supported ? If it is then what magic do I need to weave to get the method linked into my code?
Alternatives
I'm not tied to this as a solution, all I really need to do is kill the poll operation. I'm happy to kill the task making the poll call so long as I am not going to be leaving resources used when the task is deleted.
Any thoughts on how I can resolve this?
Thanks in advance,
Mark