Commit f701b520 authored by Brenden Blanco's avatar Brenden Blanco

Merge pull request #277 from SomaLDEN/drzix

perf_reader: allow more than one reader to poll
parents 7e2a0daa a411093d
......@@ -206,11 +206,15 @@ static void event_read(struct perf_reader *reader) {
}
int perf_reader_poll(int num_readers, struct perf_reader **readers, int timeout) {
struct pollfd pfds[] = {
{readers[0]->fd, POLLIN},
};
struct pollfd pfds[num_readers];
int i;
for (i = 0; i <num_readers; ++i) {
pfds[i].fd = readers[i]->fd;
pfds[i].events = POLLIN;
}
if (poll(pfds, num_readers, timeout) > 0) {
int i;
for (i = 0; i < num_readers; ++i) {
if (pfds[i].revents & POLLIN)
event_read(readers[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment