Help: looking for equivalent syscall to shutdown() but for unix pipes
Alexandre Bique
bique.alexandre@gmail.com
Fri Jan 18 21:07:00 GMT 2019
On Fri, Jan 18, 2019 at 8:39 PM Dmitry Goncharov
<dgoncharov@users.sf.net> wrote:
> int pipeFd;
> run = 1;
>
> void consumerThread()
> {
> while (run)
> {
> ret = read(pipeFd, ...);
>
> // do something with ret and the data
> }
> }
>
> void stopConsumer()
> {
> run = 0;
> pthread_kill(tid, ...); // interrupt read.
> join(...);
> }
That's quite a strong assumption that pthread_kill() would do the job.
When the data is being processed, you don't know which syscall might
be interrupted, who's going to catch the signal, how the resources are
going to be released and so on...
pthread_cancel() would not do the job either.
Regards,
--
Alexandre Bique
More information about the Libc-help
mailing list