Skip to content

Commit

Permalink
stub in epoll setup
Browse files Browse the repository at this point in the history
  • Loading branch information
carns committed Sep 6, 2024
1 parent 8249c9e commit bb4cdb8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/margo-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <time.h>
#include <math.h>
#include <json-c/json.h>
#include <sys/epoll.h>

#include "margo.h"
#include "margo-abt-macros.h"
Expand Down Expand Up @@ -2060,6 +2061,21 @@ void __margo_hg_event_progress_fn(void* foo)
size_t size;
unsigned int hg_progress_timeout;
unsigned int pending;
int epfd;
struct epoll_event epev = {0};

/* set up an epoll file descriptor that will be used to multiplex
* events. It may need to watch Mercury, the Argobots pool used to
* execute this function, timers, and internal shutdown events.
*/
/* TODO: error handling */
epfd = epoll_create(1);
assert(epfd > -1);

Check warning on line 2073 in src/margo-core.c

View check run for this annotation

Codecov / codecov/patch

src/margo-core.c#L2073

Added line #L2073 was not covered by tests
epev.events = EPOLLIN;
epev.data.fd = mid->abt.pools[mid->progress_pool_idx].efd;
fprintf(stderr, "DBG: progress pool efd: %d\n", epev.data.fd);
/* TODO: could use ptr, u32, or u64 in data */
epoll_ctl(epfd, EPOLL_CTL_ADD, epev.data.fd, &epev);

/* TODO: for now this is just a stripped down version of the normal loop
* to use as a starting point.
Expand Down Expand Up @@ -2141,6 +2157,8 @@ void __margo_hg_event_progress_fn(void* foo)
}
}

close(epfd);

return;
}

Expand Down

0 comments on commit bb4cdb8

Please sign in to comment.