Msg_Thread constructor now has no_threads which is the number of
[yazproxy-moved-to-github.git] / src / t-server.cpp
index f64999f..ad88d02 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 1998-2005, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: t-server.cpp,v 1.2 2005-06-25 15:58:33 adam Exp $
+ * $Id: t-server.cpp,v 1.4 2005-09-12 20:09:14 adam Exp $
  */
 
 #include <stdlib.h>
 
 using namespace yazpp_1;
 
-class Mutex {
-public:
-    Mutex();
-    ~Mutex();
-    void lock();
-    void unlock();
-private:
-    pthread_mutex_t m_mutex;
-    
-};
-
-Mutex::Mutex()
-{
-    pthread_mutex_init(&m_mutex, 0);
-}
-
-Mutex::~Mutex()
-{
-    pthread_mutex_destroy(&m_mutex);
-}
-void Mutex::lock()
-{
-    pthread_mutex_lock(&m_mutex);
-}
-void Mutex::unlock()
-{
-    pthread_mutex_unlock(&m_mutex);
-}
-
-
 class MyServer;
 
 class Auth_Msg : public IMsg_Thread {
@@ -216,14 +184,18 @@ int main(int argc, char **argv)
     int ret;
     const char *addr = "tcp:@:9999";
     char *apdu_log = 0;
+    int no_threads = 1;
 
-    while ((ret = options("a:v:T", argv, argc, &arg)) != -2)
+    while ((ret = options("n:a:v:T", argv, argc, &arg)) != -2)
     {
         switch (ret)
         {
         case 0:
             addr = xstrdup(arg);
             break;
+        case 'n':
+            no_threads = atoi(arg);
+            break;
         case 'a':
             apdu_log = xstrdup(arg);
             break;
@@ -245,7 +217,7 @@ int main(int argc, char **argv)
     
     MyServer *z = 0;
 
-    Msg_Thread *my_thread = new Msg_Thread(&mySocketManager);
+    Msg_Thread *my_thread = new Msg_Thread(&mySocketManager, no_threads);
 
 #if YAZ_POSIX_THREADS
     if (thread_flag)