rv->handler.pfdcount = 0;
rv->handler.pfds = XCALLOC (MTYPE_THREAD_MASTER,
sizeof (struct pollfd) * rv->handler.pfdsize);
+ rv->handler.copy = XCALLOC (MTYPE_THREAD_MASTER,
+ sizeof (struct pollfd) * rv->handler.pfdsize);
return rv;
}
close (m->io_pipe[1]);
XFREE (MTYPE_THREAD_MASTER, m->handler.pfds);
+ XFREE (MTYPE_THREAD_MASTER, m->handler.copy);
XFREE (MTYPE_THREAD_MASTER, m);
pthread_mutex_lock (&cpu_record_mtx);
timer_wait = &timer_val;
}
- /* copy pollfds so we can unlock during blocking calls to poll() */
- struct pollfd pfds[m->handler.pfdsize];
unsigned int count = m->handler.pfdcount + m->handler.pfdcountsnmp;
- memcpy (pfds, m->handler.pfds, count * sizeof (struct pollfd));
+ memcpy (m->handler.copy, m->handler.pfds, count * sizeof (struct pollfd));
pthread_mutex_unlock (&m->mtx);
{
- num = fd_poll (m, pfds, m->handler.pfdsize, count, timer_wait);
+ num = fd_poll (m, m->handler.copy, m->handler.pfdsize, count, timer_wait);
}
pthread_mutex_lock (&m->mtx);
-
+
/* Signals should get quick treatment */
if (num < 0)
{
/* Got IO, process it */
if (num > 0)
- thread_process_io (m, pfds, num, count);
+ thread_process_io (m, m->handler.copy, num, count);
#if 0
/* If any threads were made ready above (I/O or foreground timer),