- pipe(m_fd);
- obs->addObserver(m_fd[0], this);
- obs->maskObserver(this, YAZ_SOCKET_OBSERVE_READ);
-
- m_stop_flag = false;
- pthread_mutex_init(&m_mutex_input_data, 0);
- pthread_cond_init(&m_cond_input_data, 0);
- pthread_mutex_init(&m_mutex_output_data, 0);
- pthread_cond_init(&m_cond_output_data, 0);
- pthread_create(&m_thread_id, 0, tfunc, this);
+ m_p = new Private;
+
+#if YAZ_POSIX_THREADS
+ m_p->m_SocketObservable = obs;
+
+ pipe(m_p->m_fd);
+ obs->addObserver(m_p->m_fd[0], this);
+ obs->maskObserver(this, SOCKET_OBSERVE_READ);
+
+ m_p->m_stop_flag = false;
+ pthread_mutex_init(&m_p->m_mutex_input_data, 0);
+ pthread_cond_init(&m_p->m_cond_input_data, 0);
+ pthread_mutex_init(&m_p->m_mutex_output_data, 0);
+
+ m_p->m_no_threads = no_threads;
+ m_p->m_thread_id = new pthread_t[no_threads];
+ int i;
+ for (i = 0; i<m_p->m_no_threads; i++)
+ pthread_create(&m_p->m_thread_id[i], 0, tfunc, this);
+#endif