Threading primitives, in prep for removing Win32 from kernel/ and others.

This commit is contained in:
Ben Vanik
2015-07-13 22:49:29 -07:00
parent d89bad7380
commit bd490d5833
3 changed files with 247 additions and 6 deletions

View File

@@ -46,6 +46,11 @@ void XTimer::Initialize(uint32_t timer_type) {
X_STATUS XTimer::SetTimer(int64_t due_time, uint32_t period_ms,
uint32_t routine, uint32_t routine_arg, bool resume) {
// Caller is checking for STATUS_TIMER_RESUME_IGNORED.
if (resume) {
return X_STATUS_TIMER_RESUME_IGNORED;
}
// Stash routine for callback.
current_routine_ = routine;
current_routine_arg_ = routine_arg;
@@ -60,12 +65,6 @@ X_STATUS XTimer::SetTimer(int64_t due_time, uint32_t period_ms,
routine ? (PTIMERAPCROUTINE)CompletionRoutine : NULL,
this, resume ? TRUE : FALSE);
// Caller is checking for STATUS_TIMER_RESUME_IGNORED.
// This occurs if result == TRUE but error is set.
if (!result && GetLastError() == ERROR_NOT_SUPPORTED) {
return X_STATUS_TIMER_RESUME_IGNORED;
}
return result ? X_STATUS_SUCCESS : X_STATUS_UNSUCCESSFUL;
}