void bmk_sched(void);
void bmk_sched_yield(void);
+void bmk_sched_dumpqueue(void);
+
struct bmk_thread *bmk_sched_create(const char *, void *, int,
void (*)(void *), void *,
void *, unsigned long);
#include <bmk-core/core.h>
#include <bmk-core/memalloc.h>
+#include <bmk-core/printf.h>
#include <bmk-core/queue.h>
#include <bmk-core/string.h>
#include <bmk-core/sched.h>
bmk_platform_freepg2(thread->bt_stackbase, BMK_THREAD_STACK_PAGE_ORDER);
}
+static void
+print_threadinfo(struct bmk_thread *thread)
+{
+
+ bmk_printf("thread \"%s\" at %p, flags 0x%x\n",
+ thread->bt_name, thread, thread->bt_flags);
+}
+
static void
sched_switch(struct bmk_thread *prev, struct bmk_thread *next)
{
bmk_cpu_sched_switch(&prev->bt_tcb, &next->bt_tcb);
}
+
+void
+bmk_sched_dumpqueue(void)
+{
+ struct bmk_thread *thr;
+
+ bmk_printf("BEGIN schedqueue dump\n");
+ TAILQ_FOREACH(thr, &threads, bt_entries) {
+ print_threadinfo(thr);
+ }
+ bmk_printf("END schedqueue dump\n");
+}
+
void
bmk_sched(void)
{
#include <bmk-core/memalloc.h>
#include <bmk-core/platform.h>
+#include <bmk-core/printf.h>
#include <bmk-core/queue.h>
#include <bmk-core/string.h>
#include <bmk-core/sched.h>
bmk_platform_freepg2(thread->bt_stackbase, STACK_SIZE_PAGE_ORDER);
}
+static void
+print_threadinfo(struct bmk_thread *thread)
+{
+
+ bmk_printf("thread \"%s\" at %p, flags 0x%x\n",
+ thread->bt_name, thread, thread->bt_flags);
+}
+
void
sched_switch(struct bmk_thread *prev, struct bmk_thread *next)
{
return arch_sched_current();
}
+void
+bmk_sched_dumpqueue(void)
+{
+ struct bmk_thread *thr;
+
+ bmk_printf("BEGIN schedqueue dump\n");
+ TAILQ_FOREACH(thr, &threads, bt_entries) {
+ print_threadinfo(thr);
+ }
+ bmk_printf("END schedqueue dump\n");
+}
+
void
bmk_sched(void)
{