diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-07-02 20:23:07 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-07-02 20:25:47 +0300 |
commit | 23b95bf1a15322c2f471b80c06cb65d9b2d2a282 (patch) | |
tree | 9bf12231db9591852e3b42ca24715d2cbaf6267b /include/libtf/scheduler.h | |
parent | 0183e33d9a4759764716e771b85e19f7a997b8bd (diff) | |
download | libtf-master.tar.bz2 libtf-master.tar.xz |
the idea is to make libtf completely multi-threaded. meaning each
fiber can be running concurrently in separate thread. quite a bit
of framework is added for this and some atomic helpers are already
introduced. however, io polling is busy polling now (will be soon
in own thread) and timeouts are still more or less broken. oh, and
the multithreading core is not there yet. basically we are currently
mostly broken ;)
Diffstat (limited to 'include/libtf/scheduler.h')
-rw-r--r-- | include/libtf/scheduler.h | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/include/libtf/scheduler.h b/include/libtf/scheduler.h deleted file mode 100644 index db5a823..0000000 --- a/include/libtf/scheduler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* scheduler.h - libtf fiber scheduler header - * - * Copyright (C) 2009-2010 Timo Teräs <timo.teras@iki.fi> - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 or later as - * published by the Free Software Foundation. - * - * See http://www.gnu.org/ for details. - */ - -#ifndef TF_SCHEDULER_H -#define TF_SCHEDULER_H - -#include <libtf/atomic.h> -#include <libtf/list.h> -#include <libtf/heap.h> -#include <libtf/fiber.h> - -struct tf_poll_hooks; - -struct tf_scheduler { - struct tf_list_head scheduled_q; - struct tf_list_head running_q; - struct tf_heap_head heap; - void * active_fiber; - void * main_fiber; - int num_fibers; - tf_mtime_t scheduler_time; - struct tf_poll_hooks * poller; - unsigned long poll_data[2]; -}; - -static inline -struct tf_scheduler *tf_scheduler_get_current(void) -{ - extern struct tf_scheduler *__tf_scheduler; - TF_BUG_ON(__tf_scheduler == NULL); - return __tf_scheduler; -} - -static inline -tf_mtime_t tf_scheduler_get_mtime(void) -{ - return tf_scheduler_get_current()->scheduler_time; -} - -struct tf_scheduler *tf_scheduler_create(void); -int tf_scheduler_enable(struct tf_scheduler *); -void tf_scheduler_disable(void); - -static inline struct tf_scheduler * -tf_scheduler_get(struct tf_scheduler *s) -{ - tf_fiber_get(s); - return s; -} - -static inline void -tf_scheduler_put(struct tf_scheduler *s) -{ - tf_fiber_put(s); -} - -#endif - |