X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fthread_pool_observer.hpp;h=c4ef58647120fa743f109ccb297f25f51811700e;hb=fded284bf0a30c454f83741d52ccb06023b5627f;hp=c09eba470eb857785ef06cc945dd24987cb50da3;hpb=f82b19f2b93707657fee804bd1242f2548d51ada;p=metaproxy-moved-to-github.git diff --git a/src/thread_pool_observer.hpp b/src/thread_pool_observer.hpp index c09eba4..c4ef586 100644 --- a/src/thread_pool_observer.hpp +++ b/src/thread_pool_observer.hpp @@ -1,24 +1,33 @@ -/* $Id: thread_pool_observer.hpp,v 1.4 2005-10-15 14:09:09 adam Exp $ - Copyright (c) 2005, Index Data. +/* $Id: thread_pool_observer.hpp,v 1.12 2007-05-09 21:23:09 adam Exp $ + Copyright (c) 2005-2007, Index Data. -%LICENSE% +This file is part of Metaproxy. + +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 Metaproxy; see the file LICENSE. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #ifndef YP2_THREAD_POOL_OBSERVER_HPP #define YP2_THREAD_POOL_OBSERVER_HPP -#include -#include -#include +#include -#include -#include - -#include -#include +#include #include -namespace yp2 { +namespace metaproxy_1 { class IThreadPoolMsg { public: virtual IThreadPoolMsg *handle() = 0; @@ -27,38 +36,19 @@ namespace yp2 { }; class ThreadPoolSocketObserver : public yazpp_1::ISocketObserver { - private: - class Worker { - public: - Worker(ThreadPoolSocketObserver *s) : m_s(s) {}; - ThreadPoolSocketObserver *m_s; - void operator() (void) { - m_s->run(0); - } - }; + class Rep; + class Worker; public: ThreadPoolSocketObserver(yazpp_1::ISocketObservable *obs, int no_threads); virtual ~ThreadPoolSocketObserver(); - void socketNotify(int event); void put(IThreadPoolMsg *m); IThreadPoolMsg *get(); void run(void *p); - int m_fd[2]; private: - yazpp_1::ISocketObservable *m_SocketObservable; - int m_no_threads; - boost::thread_group m_thrds; - - std::deque m_input; - std::deque m_output; - - boost::mutex m_mutex_input_data; - boost::condition m_cond_input_data; - boost::mutex m_mutex_output_data; - bool m_stop_flag; + void socketNotify(int event); + boost::scoped_ptr m_p; - }; } #endif