Help: looking for equivalent syscall to shutdown() but for unix pipes

Dmitry Goncharov dgoncharov@users.sf.net
Fri Jan 18 19:39:00 GMT 2019


On Fri, Jan 18, 2019 at 2:26 PM Alexandre Bique
<bique.alexandre@gmail.com> wrote:
>
> Let's assume that the write end of the pipe is owned by a process that
> we can't modify and we know nothing about it.


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(...);
}


regards, Dmitry



More information about the Libc-help mailing list