From e2d17be2a7081888aaafea150d587a7ef9517e17 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 27 Jun 2017 20:06:42 -0700 Subject: Convert to POSIX polled I/O for async; start of cancelable aio. This eliminates the two threads per pipe that were being used to provide basic I/O handling, replacing them with a single global thread for now, that uses poll and nonblocking I/O. This should lead to great scalability. The infrastructure is in place to easily expand to multiple polling worker threads. Some thought needs to be given about how to scale this to engage multiple CPUs. Horizontal scaling may also shorten the poll() lists easing C10K problem. We should look into better solutions than poll() for platforms that have them (epoll on Linux, kqueue on BSD, and event ports on illumos). Note that the file descriptors start out in blocking mode for now, but then are placed into non-blocking mode. This is because the negotiation phase is not yet callback driven, and so needs to be synchronous. --- src/core/aio.h | 1 + src/core/timer.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src/core') diff --git a/src/core/aio.h b/src/core/aio.h index c377ca93..a5f78b3f 100644 --- a/src/core/aio.h +++ b/src/core/aio.h @@ -41,6 +41,7 @@ struct nni_aio { // TBD: Resolver operations. // Provider-use fields. + void (*a_prov_cancel)(nni_aio *); void * a_prov_data; nni_list_node a_prov_node; }; diff --git a/src/core/timer.c b/src/core/timer.c index 0224ce75..085a297a 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -14,6 +14,7 @@ static void nni_timer_loop(void *); +// XXX: replace this timer list with a minHeap based priority queue. struct nni_timer { nni_mtx t_mx; nni_cv t_cv; -- cgit v1.2.3-70-g09d2