X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fthread_pool_observer.cpp;h=832bd29faa8014b82c6f61a30569855b80c95150;hb=36cd7b13f11bb7269d4335c5a4053270ae886051;hp=d5d21f185e6a8724d894ad1f09db753e4e8e2449;hpb=3150f32c070e4b0319b99caa61197024db2a64b2;p=metaproxy-moved-to-github.git diff --git a/src/thread_pool_observer.cpp b/src/thread_pool_observer.cpp index d5d21f1..832bd29 100644 --- a/src/thread_pool_observer.cpp +++ b/src/thread_pool_observer.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2008 Index Data + Copyright (C) 2005-2011 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 @@ -22,6 +22,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #endif +#ifdef WIN32 +#include +#include +#endif #include #include #include @@ -124,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; { @@ -160,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 } } @@ -177,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 */