X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fthread_pool_observer.cpp;h=ded50d70f82fa510b7381ff91c802f70b8737103;hb=9a318d33c4c99ee4158d39e3a62988af0229d7cf;hp=360fe73d0fc2ee2c02350d23da03a30ef21a1369;hpb=637a685d61a9ff0e3f398a59da426979815c4d68;p=metaproxy-moved-to-github.git diff --git a/src/thread_pool_observer.cpp b/src/thread_pool_observer.cpp index 360fe73..ded50d7 100644 --- a/src/thread_pool_observer.cpp +++ b/src/thread_pool_observer.cpp @@ -1,7 +1,5 @@ -/* $Id: thread_pool_observer.cpp,v 1.21 2007-05-09 21:23:09 adam Exp $ - Copyright (c) 2005-2007, Index Data. - -This file is part of Metaproxy. +/* This file is part of Metaproxy. + Copyright (C) 2005-2012 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -14,24 +12,20 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Metaproxy; see the file LICENSE. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - */ +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "config.hpp" #if HAVE_UNISTD_H #include #endif + #ifdef WIN32 +#include #include #endif - -#if HAVE_SYS_SOCKET_H -#include -#endif - #include #include #include @@ -134,7 +128,16 @@ void ThreadPoolSocketObserver::socketNotify(int event) #ifdef WIN32 recv(m_p->m_pipe.read_fd(), buf, 1, 0); #else - read(m_p->m_pipe.read_fd(), buf, 1); + ssize_t r = read(m_p->m_pipe.read_fd(), buf, 1); + if (r != 1) + { + if (r == (ssize_t) (-1)) + yaz_log(YLOG_WARN|YLOG_ERRNO, + "ThreadPoolSocketObserver::socketNotify. read fail"); + else + yaz_log(YLOG_WARN, + "ThreadPoolSocketObserver::socketNotify. read returned 0"); + } #endif IThreadPoolMsg *out; { @@ -170,7 +173,16 @@ void ThreadPoolSocketObserver::run(void *p) #ifdef WIN32 send(m_p->m_pipe.write_fd(), "", 1, 0); #else - write(m_p->m_pipe.write_fd(), "", 1); + ssize_t r = write(m_p->m_pipe.write_fd(), "", 1); + if (r != 1) + { + if (r == (ssize_t) (-1)) + yaz_log(YLOG_WARN|YLOG_ERRNO, + "ThreadPoolSocketObserver::run. write fail"); + else + yaz_log(YLOG_WARN, + "ThreadPoolSocketObserver::run. write returned 0"); + } #endif } } @@ -187,8 +199,8 @@ void ThreadPoolSocketObserver::put(IThreadPoolMsg *m) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */