2 * Copyright (c) 1998-2004, Index Data.
3 * See the file LICENSE for details.
5 * $Id: yaz-pdu-assoc-thread.cpp,v 1.14 2006-03-29 13:14:17 adam Exp $
31 #include <yaz/tcpip.h>
33 #include <yazpp/pdu-assoc.h>
34 #include <yazpp/socket-manager.h>
36 using namespace yazpp_1;
45 PDU_AssocThread::PDU_AssocThread(
46 ISocketObservable *socketObservable)
47 : PDU_Assoc(socketObservable)
54 yaz_log (YLOG_LOG, "thread started");
55 while (this->m_mgr->processEvent() > 0)
57 yaz_log (YLOG_LOG, "thread finished");
69 worker *w = (worker *) p;
77 void PDU_AssocThread::childNotify(COMSTACK cs)
79 SocketManager *socket_observable = new SocketManager;
80 PDU_Assoc *new_observable = new PDU_Assoc (socket_observable, cs);
82 /// Clone PDU Observer
83 new_observable->m_PDU_Observer =
84 m_PDU_Observer->sessionNotify(new_observable, cs_fileno(cs));
86 worker *w = new worker;
87 w->m_assoc = new_observable;
88 w->m_mgr = socket_observable;
92 t_id = _beginthread (events, 0, w);
95 yaz_log (YLOG_FATAL|YLOG_ERRNO, "_beginthread failed");
101 int id = pthread_create (&tid, 0, events, w);
103 yaz_log (YLOG_ERRNO|YLOG_FATAL, "pthread_create returned id=%d", id);
105 pthread_detach (tid);
112 * indent-tabs-mode: nil
114 * vim: shiftwidth=4 tabstop=8 expandtab