diff options
author | Christian Cunningham <cc@localhost> | 2022-02-01 20:36:30 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-02-01 20:36:30 -0700 |
commit | 7d3884b5cfc282dbdfe5d9a22d8b2b343280b8af (patch) | |
tree | a3e5e5376c35cce48d1e2d907720646448c5e2ba /src/cpu | |
parent | 98793badc1c1d3e4bfd735fdecd3d2d731701ab3 (diff) |
Thread yield control to any other threads
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/irq.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cpu/irq.c b/src/cpu/irq.c index 612b6d8..2197067 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -140,14 +140,15 @@ void testfxn2(void) void testfxn(void) { - unsigned int i = 0x69420; + unsigned long long ti = get_sys_time(); + unsigned int i = 0xDEADBEEF; void* a = malloc(5); void* b = malloc(3); void* c = malloc(4); void* d = malloc(4); uart_string("Start\n"); add_thread(testfxn2, 0, 0); - delay(0x20000000); + sys0(SYS_YIELD); uart_string("Freeing B\n"); free(b); uart_string("Freeing A\n"); @@ -160,4 +161,11 @@ void testfxn(void) delay(0x20000000); uart_hexn(i); uart_string("End\n"); + unsigned long long tf = get_sys_time(); + unsigned long long dt = tf-ti; + unsigned long thi, tlo; + thi = dt >> 32; + tlo = dt; + uart_hex(thi); + uart_hexn(tlo); } |