kern: add abstract scoped lock template

This commit is contained in:
Michael Scire 2020-01-31 16:37:58 -08:00
parent 57222e8301
commit 2355047715
5 changed files with 53 additions and 57 deletions

View file

@ -63,10 +63,8 @@ namespace ams::kern {
static void EnableSchedulingAndSchedule(u64 cores_needing_scheduling);
};
class KScopedSchedulerLock {
public:
ALWAYS_INLINE KScopedSchedulerLock() { KScheduler::s_scheduler_lock.Lock(); }
ALWAYS_INLINE ~KScopedSchedulerLock() { KScheduler::s_scheduler_lock.Unlock(); }
class KScopedSchedulerLock : KScopedLock<KScheduler::LockType> {
explicit ALWAYS_INLINE KScopedSchedulerLock() : KScopedLock(KScheduler::s_scheduler_lock) { /* ... */ }
};
}