Moving ThreadPoolSocketObserver and IThreadPoolMsg to yp2 namespace
[metaproxy-moved-to-github.git] / src / thread_pool_observer.hpp
index 4f9636d..c52dca1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: thread_pool_observer.hpp,v 1.2 2005-10-14 10:08:40 adam Exp $
+/* $Id: thread_pool_observer.hpp,v 1.3 2005-10-14 10:27:18 adam Exp $
    Copyright (c) 1998-2005, Index Data.
 
 This file is part of the yaz-proxy.
@@ -33,47 +33,49 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <yaz++/socket-observer.h>
 #include <yaz/yconfig.h>
 
-class IThreadPoolMsg {
-public:
-    virtual IThreadPoolMsg *handle() = 0;
-    virtual void result() = 0;
-    virtual ~IThreadPoolMsg();
-};
-
-class ThreadPoolSocketObserver : public yazpp_1::ISocketObserver {
-private:
-    class Worker {
+namespace yp2 {
+    class IThreadPoolMsg {
     public:
-        Worker(ThreadPoolSocketObserver *s) : m_s(s) {};
-        ThreadPoolSocketObserver *m_s;
-        void operator() (void) {
-            m_s->run(0);
-        }
+        virtual IThreadPoolMsg *handle() = 0;
+        virtual void result() = 0;
+        virtual ~IThreadPoolMsg();
     };
-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<IThreadPoolMsg *> m_input;
-    std::deque<IThreadPoolMsg *> m_output;
+    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);
+            }
+        };
+    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;
 
-    boost::mutex m_mutex_input_data;
-    boost::condition m_cond_input_data;
-    boost::mutex m_mutex_output_data;
-    bool m_stop_flag;
+        std::deque<IThreadPoolMsg *> m_input;
+        std::deque<IThreadPoolMsg *> m_output;
 
-    
-};
+        boost::mutex m_mutex_input_data;
+        boost::condition m_cond_input_data;
+        boost::mutex m_mutex_output_data;
+        bool m_stop_flag;
 
+    
+    };
+}
 #endif
 /*
  * Local variables: