mittos65/src/kernel/boot/TEMP-test_scheduler.c

38 lines
739 B
C

#include <framebuffer.h>
#include <proc.h>
#include <sched.h>
extern gfx_context *term_fb;
void drawCharacter(gfx_context *ctx, uint64_t x, uint64_t y, uint32_t clr_fg, uint32_t clr_bg, char c);
void thread1()
{
int a = 0;
while(1) {
drawCharacter(term_fb, 0, 0, RGB(255,0,0), RGB(0,0,0), '0'+(a++%10));
flip(term_fb);
sched_yield();
}
}
void thread2()
{
int a = 0;
while(1) {
drawCharacter(term_fb, 10, 10, RGB(0,0,255), RGB(0,0,0), 'A'+(a++%10));
flip(term_fb);
sched_yield();
}
}
void TEMP_test_scheduler()
{
struct thread *th1 = new_thread(thread1);
scheduler_insert(th1);
struct thread *th2 = new_thread(thread2);
scheduler_insert(th2);
}