A problem with poll

Jose-Marcio.Martins at ensmp.fr jose-marcio.martins at ensmp.fr
Thu May 20 12:54:56 PDT 2004



Hello,

I'm using a pipe to communicate between threads in the same process.

In fact, I've a thread waiting (using poll) for data available on some 
set of file descriptors.

 From time to time I need to interrupt the poll call in order to add a 
new file descriptor. I do this with the pipe.

I add p[0] to the poll set and I write to p[1] when I want to interrupt 
the poll call.

The problem is that poll returns as expected, but the read on the file 
descriptor blocks.

Before the poll call, I set events flags to  POLLIN | POLLPRI. When poll 
returns, events is set to POLLIN [ POLLPRI, and revents is 0. Value 
returned by poll is the good number of file descriptors ready.

What I'm doing wrong ?

Thanks for your help

Joe


-- 
  ---------------------------------------------------------------
  Jose Marcio MARTINS DA CRUZ           Tel. :(33) 01.40.51.93.41
  Ecole des Mines de Paris              http://j-chkmail.ensmp.fr
  60, bd Saint Michel                http://www.ensmp.fr/~martins
  75272 - PARIS CEDEX 06      mailto:Jose-Marcio.Martins at ensmp.fr




More information about the freebsd-hackers mailing list