Fix crash when providing bad command line argument
[clinton/bobotpp.git] / source / BotThreading.C
index 75812b3..2ff93e0 100644 (file)
 BotMutex::BotMutex (bool recursive)
 {
   pthread_t self = pthread_self ();
+#if 0
   std::cerr << "Mutex Init..."
            << " Mutex: " << &mutex
            << " Thread: " << &self
            << std::endl;
+#endif
   pthread_mutexattr_init (&attrs);
 
   if (recursive)
@@ -42,31 +44,33 @@ BotMutex::BotMutex (bool recursive)
 BotMutex::~BotMutex ()
 {
   pthread_t self = pthread_self ();
+#if 0
   std::cerr << "Mutex Destroy..."
            << " Mutex: " << &mutex
            << " Thread: " << &self
            << std::endl;
+#endif
   pthread_mutex_destroy (&mutex);
   pthread_mutexattr_destroy (&attrs);
 }
 
 void BotMutex::lock ()
 {
-  pthread_t self = pthread_self ();
-  std::cerr << "< Mutex Lock..."
-           << " Mutex: " << &mutex
-           << " Thread: " << &self
-           << std::endl;
+//   pthread_t self = pthread_self ();
+//   std::cerr << "< Mutex Lock..."
+//         << " Mutex: " << &mutex
+//         << " Thread: " << &self
+//         << std::endl;
   pthread_mutex_lock (&mutex);
 }
 
 void BotMutex::unlock ()
 {
-  pthread_t self = pthread_self ();
-  std::cerr << "> Mutex Unlock..."
-           << " Mutex: " << &mutex
-           << " Thread: " << &self
-           << std::endl;
+//   pthread_t self = pthread_self ();
+//   std::cerr << "> Mutex Unlock..."
+//         << " Mutex: " << &mutex
+//         << " Thread: " << &self
+//         << std::endl;
   pthread_mutex_unlock (&mutex);
 }
 
@@ -89,22 +93,22 @@ void BotMutex::unlock ()
 BotLock::BotLock (BotMutex & m)
   : mutex(m)
 {
-  pthread_t self = pthread_self ();
-  std::cerr << "Lock Init..."
-           << " Lock: " << this
-           << " Mutex: " << &mutex
-           << " Thread: " << &self
-           << std::endl;
+//   pthread_t self = pthread_self ();
+//   std::cerr << "Lock Init..."
+//         << " Lock: " << this
+//         << " Mutex: " << &mutex
+//         << " Thread: " << &self
+//         << std::endl;
   mutex.lock ();
 }
 
 BotLock::~BotLock ()
 {
-  pthread_t self = pthread_self ();
-  std::cerr << "Lock Destroy..."
-           << " Lock: " << this
-           << " Mutex: " << &mutex
-           << " Thread: " << &self
-           << std::endl;
+//   pthread_t self = pthread_self ();
+//   std::cerr << "Lock Destroy..."
+//         << " Lock: " << this
+//         << " Mutex: " << &mutex
+//         << " Thread: " << &self
+//         << std::endl;
   mutex.unlock ();
 }