[Zion] Add a thread sleep call.
For now this can only sleep in increments of the scheduler quantum (currently 50ms). It also uses a somewhat ineffecient way of tracking the sleeping threads - it will scale linearly with the number of sleeping threads.
This commit is contained in:
parent
66e94ac41b
commit
8adde27d9b
9 changed files with 48 additions and 5 deletions
|
|
@ -59,6 +59,7 @@ extern "C" z_err_t SyscallHandler(uint64_t call_id, void* req) {
|
|||
CASE(ThreadStart);
|
||||
CASE(ThreadExit);
|
||||
CASE(ThreadWait);
|
||||
CASE(ThreadSleep);
|
||||
// syscall/address_space.h
|
||||
CASE(AddressSpaceMap);
|
||||
CASE(AddressSpaceUnmap);
|
||||
|
|
|
|||
|
|
@ -53,3 +53,8 @@ glcr::ErrorCode ThreadWait(ZThreadWaitReq* req) {
|
|||
thread->Wait();
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
glcr::ErrorCode ThreadSleep(ZThreadSleepReq* req) {
|
||||
gScheduler->Sleep(req->millis);
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,3 +8,4 @@ glcr::ErrorCode ThreadCreate(ZThreadCreateReq* req);
|
|||
glcr::ErrorCode ThreadStart(ZThreadStartReq* req);
|
||||
glcr::ErrorCode ThreadExit(ZThreadExitReq*);
|
||||
glcr::ErrorCode ThreadWait(ZThreadWaitReq* req);
|
||||
glcr::ErrorCode ThreadSleep(ZThreadSleepReq* req);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue