Pimpl the ThreadPoolSocketObserver class so we can make code depending
[metaproxy-moved-to-github.git] / src / thread_pool_observer.hpp
1 /* $Id: thread_pool_observer.hpp,v 1.6 2005-11-04 11:06:52 adam Exp $
2    Copyright (c) 2005, Index Data.
3
4 %LICENSE%
5  */
6
7 #ifndef YP2_THREAD_POOL_OBSERVER_HPP
8 #define YP2_THREAD_POOL_OBSERVER_HPP
9
10 #include <boost/scoped_ptr.hpp>
11
12 #include <ctype.h>
13
14 #include <deque>
15 #include <yaz++/socket-observer.h>
16 #include <yaz/yconfig.h>
17
18 namespace yp2 {
19     class IThreadPoolMsg {
20     public:
21         virtual IThreadPoolMsg *handle() = 0;
22         virtual void result() = 0;
23         virtual ~IThreadPoolMsg();
24     };
25
26     class ThreadPoolSocketObserver : public yazpp_1::ISocketObserver {
27         class Rep;
28         class Worker;
29     public:
30         ThreadPoolSocketObserver(yazpp_1::ISocketObservable *obs,
31                                  int no_threads);
32         virtual ~ThreadPoolSocketObserver();
33         void put(IThreadPoolMsg *m);
34         IThreadPoolMsg *get();
35         void run(void *p);
36     private:
37         void socketNotify(int event);
38         boost::scoped_ptr<Rep> m_p;
39
40     };
41 }
42 #endif
43 /*
44  * Local variables:
45  * c-basic-offset: 4
46  * indent-tabs-mode: nil
47  * c-file-style: "stroustrup"
48  * End:
49  * vim: shiftwidth=4 tabstop=8 expandtab
50  */
51