projects
/
yazpp-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added new class GDU.
[yazpp-moved-to-github.git]
/
src
/
yaz-pdu-assoc-thread.cpp
diff --git
a/src/yaz-pdu-assoc-thread.cpp
b/src/yaz-pdu-assoc-thread.cpp
index
4a445fd
..
207a68b
100644
(file)
--- a/
src/yaz-pdu-assoc-thread.cpp
+++ b/
src/yaz-pdu-assoc-thread.cpp
@@
-1,15
+1,28
@@
/*
/*
- * Copyright (c) 1998-2001, Index Data.
+ * Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
* See the file LICENSE for details.
*
- * $Id: yaz-pdu-assoc-thread.cpp,v 1.4 2001-11-04 22:36:21 adam Exp $
+ * $Id: yaz-pdu-assoc-thread.cpp,v 1.11 2005-06-08 13:28:06 adam Exp $
*/
#ifdef WIN32
*/
#ifdef WIN32
+#define USE_THREADS 1
+#endif
+
+#if YAZ_POSIX_THREADS
+#define USE_THREADS 1
+#endif
+
+#if USE_THREADS
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef WIN32
#include <process.h>
#else
#include <pthread.h>
#include <process.h>
#else
#include <pthread.h>
-#include <unistd.h>
#endif
#endif
@@
-17,14
+30,14
@@
#include <yaz/log.h>
#include <yaz/tcpip.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>
+using namespace yazpp_1;
-Yaz_PDU_AssocThread::Yaz_PDU_AssocThread(
- IYazSocketObservable *socketObservable)
- : Yaz_PDU_Assoc(socketObservable)
+PDU_AssocThread::PDU_AssocThread(
+ ISocketObservable *socketObservable)
+ : PDU_Assoc(socketObservable)
{
}
{
}
@@
-36,22
+49,22
@@
void *
#endif
events(void *p)
{
#endif
events(void *p)
{
- Yaz_SocketManager *s = (Yaz_SocketManager *) p;
+ SocketManager *s = (SocketManager *) p;
- yaz_log (LOG_LOG, "thread started");
+ yaz_log (YLOG_LOG, "thread started");
while (s->processEvent() > 0)
;
while (s->processEvent() > 0)
;
- yaz_log (LOG_LOG, "thread finished");
+ yaz_log (YLOG_LOG, "thread finished");
#ifdef WIN32
#else
return 0;
#endif
}
#ifdef WIN32
#else
return 0;
#endif
}
-void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
+void PDU_AssocThread::childNotify(COMSTACK cs)
{
{
- Yaz_SocketManager *socket_observable = new Yaz_SocketManager;
- Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (socket_observable, cs);
+ SocketManager *socket_observable = new SocketManager;
+ PDU_Assoc *new_observable = new PDU_Assoc (socket_observable, cs);
new_observable->m_next = m_children;
m_children = new_observable;
new_observable->m_next = m_children;
m_children = new_observable;
@@
-65,7
+78,7
@@
void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
t_id = _beginthread (events, 0, socket_observable);
if (t_id == -1)
{
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
exit (1);
}
#else
@@
-73,8
+86,9
@@
void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
int id = pthread_create (&tid, 0, events, socket_observable);
if (id)
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
}
else
pthread_detach (tid);
#endif
}
+#endif