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
Lib paths etc
[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
5f7a20e
..
d59846c
100644
(file)
--- a/
src/yaz-pdu-assoc-thread.cpp
+++ b/
src/yaz-pdu-assoc-thread.cpp
@@
-3,22
+3,32
@@
* See the file LICENSE for details.
*
* $Log: yaz-pdu-assoc-thread.cpp,v $
* See the file LICENSE for details.
*
* $Log: yaz-pdu-assoc-thread.cpp,v $
- * Revision 1.1 2001-03-26 14:43:49 adam
+ * Revision 1.3 2001-08-13 16:39:12 adam
+ * PDU_Assoc keeps track of children. Using yaz_log instead of logf.
+ *
+ * Revision 1.2 2001/03/27 14:47:45 adam
+ * New server facility scheme.
+ *
+ * Revision 1.1 2001/03/26 14:43:49 adam
* New threaded PDU association.
*
*/
* New threaded PDU association.
*
*/
+#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/log.h>
#include <yaz/tcpip.h>
#include <yaz++/yaz-pdu-assoc.h>
#include <yaz++/yaz-socket-manager.h>
-#ifdef WIN32
-#include <process.h>
-#else
-#include <pthread.h>
-#endif
Yaz_PDU_AssocThread::Yaz_PDU_AssocThread(
Yaz_PDU_AssocThread::Yaz_PDU_AssocThread(
@@
-37,10
+47,10
@@
events(void *p)
{
Yaz_SocketManager *s = (Yaz_SocketManager *) p;
{
Yaz_SocketManager *s = (Yaz_SocketManager *) p;
- logf (LOG_LOG, "thread started");
+ yaz_log (LOG_LOG, "thread started");
while (s->processEvent() > 0)
;
while (s->processEvent() > 0)
;
- logf (LOG_LOG, "thread finished");
+ yaz_log (LOG_LOG, "thread finished");
#ifdef WIN32
#else
return 0;
#ifdef WIN32
#else
return 0;
@@
-51,7
+61,11
@@
void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
{
Yaz_SocketManager *socket_observable = new Yaz_SocketManager;
Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (socket_observable, cs);
{
Yaz_SocketManager *socket_observable = new Yaz_SocketManager;
Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (socket_observable, cs);
-
+
+ new_observable->m_next = m_children;
+ m_children = new_observable;
+ new_observable->m_parent = this;
+
/// Clone PDU Observer
new_observable->m_PDU_Observer =
m_PDU_Observer->sessionNotify(new_observable, cs_fileno(cs));
/// Clone PDU Observer
new_observable->m_PDU_Observer =
m_PDU_Observer->sessionNotify(new_observable, cs_fileno(cs));
@@
-64,9
+78,12
@@
void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
exit (1);
}
#else
exit (1);
}
#else
- pthread_t type;
+ pthread_t tid;
- int id = pthread_create (&type, 0, events, socket_observable);
- yaz_log (LOG_LOG, "pthread_create returned id=%d", id);
+ int id = pthread_create (&tid, 0, events, socket_observable);
+ if (id)
+ yaz_log (LOG_ERRNO|LOG_FATAL, "pthread_create returned id=%d", id);
+ else
+ pthread_detach (tid);
#endif
}
#endif
}