From 9c2f40441e0cc909ebefe432ddc10e2de29b82ac Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 7 Sep 2020 00:17:04 +0200 Subject: Added wait syscall. This makes a process sleep until it receives a new message (no polling!). I thought that this will result in performance improvements but I haven't noticed any, yet. Maybe I'll remove this again in the future.. --- apps/init.c | 3 +++ apps/mandelbrot.c | 3 +-- apps/wm.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/init.c b/apps/init.c index ba6f93e..ccf88dd 100644 --- a/apps/init.c +++ b/apps/init.c @@ -13,5 +13,8 @@ int main(int argc, char **argv) /* int test = exec("/window", "test", NULL); */ int mandelbrot = exec("/mandelbrot", "mandelbrot", NULL); + while (1) { + yield(); + }; return wm + mandelbrot; } diff --git a/apps/mandelbrot.c b/apps/mandelbrot.c index d5b8ae0..9f73501 100644 --- a/apps/mandelbrot.c +++ b/apps/mandelbrot.c @@ -49,7 +49,6 @@ void draw_mandelbrot(struct window *win, int resolution) } gui_redraw(); print("Rendered mandelbrot successfully\n"); - yield(); } int main() @@ -62,7 +61,7 @@ int main() draw_mandelbrot(win, 50); while (1) { - yield(); + wait(); }; return 0; diff --git a/apps/wm.c b/apps/wm.c index 477eb7f..d4db938 100644 --- a/apps/wm.c +++ b/apps/wm.c @@ -12,7 +12,7 @@ #include #include -#define MOUSE_SKIP 4 // => Every nth move gets skipped +#define MOUSE_SKIP 5 // => Every move % n != 0 gets skipped static struct vbe *vbe; static struct window *direct; // Direct video memory window @@ -84,7 +84,7 @@ int main(int argc, char **argv) int mouse_skip = 0; while (1) { if (!(msg = msg_receive())) { - yield(); + wait(); continue; } -- cgit v1.2.3