Allos Msg_Thread to operate in non-threaded mode
[yazproxy-moved-to-github.git] / src / msg-thread.h
index 0d0729f..b7e4e57 100644 (file)
@@ -1,7 +1,7 @@
-/* $Id: msg-thread.h,v 1.1 2005-05-30 20:08:58 adam Exp $
-   Copyright (c) 1998-2005, Index Data.
+/* $Id: msg-thread.h,v 1.10 2006-03-30 13:29:23 adam Exp $
+   Copyright (c) 1998-2006, Index Data.
 
-This file is part of the yaz-proxy.
+This file is part of the yazproxy.
 
 YAZ proxy 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
@@ -19,21 +19,17 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
  */
 
-#include <pthread.h>
 #include <unistd.h>
 #include <ctype.h>
 
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <yaz++/socket-observer.h>
+#include <yazpp/socket-observer.h>
 #include <yaz/yconfig.h>
 
 class IMsg_Thread {
 public:
     virtual IMsg_Thread *handle() = 0;
     virtual void result() = 0;
+    virtual ~IMsg_Thread();
 };
 
 class Msg_Thread_Queue_List {
@@ -53,24 +49,24 @@ class Msg_Thread_Queue {
     Msg_Thread_Queue_List *m_list;
 };
 
-class Msg_Thread : public IYazSocketObserver {
+class Msg_Thread : public yazpp_1::ISocketObserver {
+    class Private;
  public:
-    Msg_Thread(IYazSocketObservable *obs);
+    Msg_Thread(yazpp_1::ISocketObservable *obs, int no_threads);
     virtual ~Msg_Thread();
     void socketNotify(int event);
     void put(IMsg_Thread *m);
     IMsg_Thread *get();
     void run(void *p);
-    int m_fd[2];
 private:
-    IYazSocketObservable *m_SocketObservable;
-    pthread_t m_thread_id;
-    Msg_Thread_Queue m_input;
-    Msg_Thread_Queue m_output;
-    pthread_mutex_t m_mutex_input_data;
-    pthread_cond_t m_cond_input_data;
-    pthread_mutex_t m_mutex_output_data;
-    pthread_cond_t m_cond_output_data;
-    bool m_stop_flag;
+    class Private *m_p;
 };
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+