Search Postgresql Archives

PQconsumeinput() may close the fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
 
There is an event loop in my program (libev) and I do PQconsumeInput() if there is something ready in the PG socket fd. The problem is that sometimes PQconsumeInput() may close the connection and I learn it by checking for PQsocket() afterwards only. AFAICS, there is no way to learn it beforehand. The core issue is that I have to deregister socket fd in the event loop, but the fd is already closed. It is already not good because we're still working with already invalid fd, but worse, in multithreaded env other thread might open a socket with the same fd number and mess all the things.
 
So, what to do in this case? Should I use other API that may not close fd? Or only select/poll API may be used with every time fd registration, but not epoll? Or maybe I'm wrong in some other way?
 
Thanks in advance.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux