KnightOS
KnightOS copied to clipboard
Add kernel API for examining running threads.
There's already some stuff in place for examining individual threads, but not all of them.
;; getNextThreadID [Threading]
;; Gets the next running thread's ID.
;; Inputs:
;; B: Thread index (0 for first thread)
;; Outputs:
;; A: Thread ID or 0xFF if no more threads
;; B: Incremented
;; Notes:
;; It would be silly to call this without interrupts disabled.
;;
;; This will return your own thread at some point.
Probably worth giving all of the current threading syscalls a review to make sure sufficient information is exposed and things that shouldn't be exposed are kept private.
Is there a method to find the number of running threads?
No, you should call getNextThreadID
in a loop and count it yourself.
Not that getNextThreadID
exists, that will have to be written.