Handle present out of range better in sample server.
[yazpp-moved-to-github.git] / src / yaz-pdu-assoc-thread.cpp
index aadcca1..fd4373a 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 1998-2001, Index Data.
+ * Copyright (c) 1998-2004, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: yaz-pdu-assoc-thread.cpp,v 1.5 2001-11-06 17:08:05 adam Exp $
+ * $Id: yaz-pdu-assoc-thread.cpp,v 1.9 2005-01-14 10:13:50 adam Exp $
  */
 
 #ifdef WIN32
 
 #if USE_THREADS
 
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef WIN32
 #include <process.h>
 #else
 #include <pthread.h>
-#include <unistd.h>
 #endif
 
+
 #include <errno.h>
 #include <yaz/log.h>
 #include <yaz/tcpip.h>
 
-#include <yaz++/yaz-pdu-assoc.h>
-#include <yaz++/yaz-socket-manager.h>
+#include <yaz++/pdu-assoc.h>
+#include <yaz++/socket-manager.h>
 
 Yaz_PDU_AssocThread::Yaz_PDU_AssocThread(
     IYazSocketObservable *socketObservable)
@@ -45,10 +49,10 @@ events(void *p)
 {
     Yaz_SocketManager *s = (Yaz_SocketManager *) p;
     
-    yaz_log (LOG_LOG, "thread started");
+    yaz_log (YLOG_LOG, "thread started");
     while (s->processEvent() > 0)
        ;
-    yaz_log (LOG_LOG, "thread finished");
+    yaz_log (YLOG_LOG, "thread finished");
 #ifdef WIN32
 #else
     return 0;
@@ -72,7 +76,7 @@ void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
     t_id = _beginthread (events, 0, socket_observable);
     if (t_id == -1)
     {
-        yaz_log (LOG_FATAL|LOG_ERRNO, "_beginthread failed");
+        yaz_log (YLOG_FATAL|YLOG_ERRNO, "_beginthread failed");
         exit (1);
     }
 #else
@@ -80,7 +84,7 @@ void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
 
     int id = pthread_create (&tid, 0, events, socket_observable);
     if (id)
-       yaz_log (LOG_ERRNO|LOG_FATAL, "pthread_create returned id=%d", id);
+       yaz_log (YLOG_ERRNO|YLOG_FATAL, "pthread_create returned id=%d", id);
     else
        pthread_detach (tid);
 #endif