fd = *((int *) args);
+ RRDD_LOG (LOG_DEBUG, "connection_thread_main: Adding myself to "
+ "connetion_threads[]..");
+ pthread_mutex_lock (&connetion_threads_lock);
+ {
+ pthread_t *temp;
+
+ temp = (pthread_t *) realloc (connetion_threads,
+ sizeof (pthread_t) * (connetion_threads_num + 1));
+ if (temp == NULL)
+ {
+ RRDD_LOG (LOG_ERR, "connection_thread_main: realloc failed.");
+ }
+ else
+ {
+ connetion_threads = temp;
+ connetion_threads[connetion_threads_num] = pthread_self ();
+ connetion_threads_num++;
+ }
+ }
+ pthread_mutex_unlock (&connetion_threads_lock);
+ RRDD_LOG (LOG_DEBUG, "connection_thread_main: done");
+
while (do_shutdown == 0)
{
struct pollfd pollfd;
continue;
}
- /* FIXME: bug: if the new thread is run first, it may run into the
- * assert (i < connetion_threads_num);
- * assertion. */
- pthread_mutex_lock (&connetion_threads_lock);
- {
- pthread_t *temp;
-
- temp = (pthread_t *) realloc (connetion_threads,
- sizeof (pthread_t) * (connetion_threads_num + 1));
- if (temp == NULL)
- {
- RRDD_LOG (LOG_ERR, "listen_thread_main: realloc failed.");
- }
- else
- {
- connetion_threads = temp;
- connetion_threads[connetion_threads_num] = tid;
- connetion_threads_num++;
- }
- }
- pthread_mutex_unlock (&connetion_threads_lock);
+ RRDD_LOG (LOG_DEBUG, "listen_thread_main: pthread_create succeeded: "
+ "tid = %lu",
+ *((unsigned long *) &tid));
} /* while (do_shutdown == 0) */
close_listen_sockets ();