summaryrefslogtreecommitdiffstats
path: root/src/scheduler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scheduler.c')
-rw-r--r--src/scheduler.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/scheduler.c b/src/scheduler.c
index d287eca..a103d0a 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -15,6 +15,7 @@
#include <libtf/io.h>
/* FIXME: should be in thread local storage */
+extern struct tf_poll_hooks tf_epoll_hooks;
struct tf_scheduler *__tf_scheduler;
static void update_time(struct tf_scheduler *sched)
@@ -59,7 +60,7 @@ void tf_scheduler_fiber(void *data)
timeout = -1;
}
- if (tf_poll(timeout) == TF_WAKEUP_TIMEOUT &&
+ if (sched->poller->poll(timeout) == TF_WAKEUP_TIMEOUT &&
timeout >= 0) {
sched->scheduler_time += timeout;
process_heap(sched);
@@ -103,7 +104,8 @@ int tf_scheduler_enable(struct tf_scheduler *sched)
__tf_fiber_bind_scheduler(s);
__tf_scheduler = s;
- tf_poll_init();
+ s->poller = &tf_epoll_hooks;
+ s->poller->init();
update_time(s);
if (sched != NULL)
@@ -124,7 +126,7 @@ void tf_scheduler_disable(void)
while (sched->num_fibers > 1)
__tf_fiber_schedule();
- tf_poll_close();
+ sched->poller->close();
__tf_scheduler = NULL;
__tf_fiber_release_scheduler(sched);
tf_heap_destroy(&sched->heap);