X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;ds=sidebyside;f=src%2Fthread_pool_observer.cpp;h=653e42f010864f79d448e5c8ea074a3b08ed3526;hb=b0c61b7f8b17d876c88347a96c246c47493140da;hp=36cf783aeaa6e5ec0b49c556e0a3324591d1d998;hpb=a715926f3a2dc33f605b119561ccac38322f1c7b;p=metaproxy-moved-to-github.git diff --git a/src/thread_pool_observer.cpp b/src/thread_pool_observer.cpp index 36cf783..653e42f 100644 --- a/src/thread_pool_observer.cpp +++ b/src/thread_pool_observer.cpp @@ -1,20 +1,26 @@ -/* $Id: thread_pool_observer.cpp,v 1.20 2007-04-18 12:06:59 adam Exp $ - Copyright (c) 2005-2007, Index Data. +/* This file is part of Metaproxy. + Copyright (C) 2005-2010 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 +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +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 this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ - See the LICENSE file for details - */ #include "config.hpp" #if HAVE_UNISTD_H #include #endif -#ifdef WIN32 -#include -#endif - -#if HAVE_SYS_SOCKET_H -#include -#endif #include #include @@ -118,7 +124,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; { @@ -154,7 +169,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 } } @@ -171,8 +195,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 */