aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sys/schedule.c2
-rw-r--r--src/tests/test.c29
2 files changed, 30 insertions, 1 deletions
diff --git a/src/sys/schedule.c b/src/sys/schedule.c
index f54811d..9b6d46e 100644
--- a/src/sys/schedule.c
+++ b/src/sys/schedule.c
@@ -344,7 +344,7 @@ void c_cleanup(void)
struct Thread* rt = scheduler.rthread;
struct Entry* e = pop_thread_from_queue(THREAD_READY, rt->priority);
// Add to free threads
- prepend_to_queue(e, &scheduler.free_threads);
+ push_to_queue(e, &scheduler.free_threads);
}
void yield(void)
diff --git a/src/tests/test.c b/src/tests/test.c
index 0dad659..d954ade 100644
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -431,6 +431,32 @@ void semaphore_test1(void)
sys1(SYS_SEMAPHORE_P, &test_semaphore);
// Semaphore decremented
draw_cletter(x++, y+1, 'P', 0xFF0000);
+ draw_cletter(x++, y+1, 'V', 0xFF0000);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ draw_cletter(x++, y+1, 'V', 0xFF0000);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ draw_cletter(x++, y+1, 'V', 0xFF0000);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
draw_cletter(x++, y+1, 'F', 0xFF0000);
}
@@ -440,6 +466,9 @@ void semaphore_test2(void)
// Increment semaphore
draw_cletter(x++, y+2, 'V', 0xFF00);
sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ // Increment semaphore
+ draw_cletter(x++, y+2, 'V', 0xFF00);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
draw_cletter(x++, y+2, 'F', 0xFF00);
}