![]() |
Max OS 0.3
|
Enables a resource to be used by only one instance at a time through locking and unlocking. More...
#include <spinlock.h>
Public Member Functions | |
| void | lock () |
| Lock the spinlock once it is available. | |
| void | unlock () |
| Unlock the spinlock. | |
| bool | is_locked () const |
| Check if the spinlock is locked. | |
| void | acquire () |
| Acquire the spinlock: wait until the lock is available, spinning until that happens. | |
| void | release () |
| Release the spinlock. | |
Enables a resource to be used by only one instance at a time through locking and unlocking.
Definition at line 21 of file spinlock.h.
| void Spinlock::acquire | ( | ) |
Acquire the spinlock: wait until the lock is available, spinning until that happens.
Definition at line 51 of file spinlock.cpp.
Referenced by lock().
| bool Spinlock::is_locked | ( | ) | const |
Check if the spinlock is locked.
Definition at line 43 of file spinlock.cpp.
| void Spinlock::lock | ( | ) |
Lock the spinlock once it is available.
Definition at line 24 of file spinlock.cpp.
References acquire().
Referenced by MaxOS::processes::Process::add_thread(), MaxOS::memory::PhysicalMemoryManager::allocate_area(), MaxOS::memory::PhysicalMemoryManager::allocate_frame(), MaxOS::filesystem::format::ext2::Ext2Volume::create_inode(), MaxOS::filesystem::format::ext2::InodeHandler::free(), MaxOS::memory::PhysicalMemoryManager::free_area(), MaxOS::memory::PhysicalMemoryManager::free_frame(), MaxOS::filesystem::format::ext2::Ext2File::read(), MaxOS::filesystem::format::ext2::Ext2Directory::read_from_disk(), MaxOS::memory::PhysicalMemoryManager::reserve(), MaxOS::filesystem::format::ext2::Ext2File::write(), and MaxOS::processes::SharedMessageEndpoint::write().
| void Spinlock::release | ( | ) |
| void Spinlock::unlock | ( | ) |
Unlock the spinlock.
Definition at line 32 of file spinlock.cpp.
References release().
Referenced by MaxOS::processes::Process::add_thread(), MaxOS::memory::PhysicalMemoryManager::allocate_area(), MaxOS::memory::PhysicalMemoryManager::allocate_frame(), MaxOS::filesystem::format::ext2::Ext2Volume::create_inode(), MaxOS::filesystem::format::ext2::InodeHandler::free(), MaxOS::memory::PhysicalMemoryManager::free_area(), MaxOS::memory::PhysicalMemoryManager::free_frame(), MaxOS::memory::PhysicalMemoryManager::PhysicalMemoryManager(), MaxOS::filesystem::format::ext2::Ext2File::read(), MaxOS::filesystem::format::ext2::Ext2Directory::read_from_disk(), MaxOS::memory::PhysicalMemoryManager::reserve(), MaxOS::filesystem::format::ext2::Ext2File::write(), and MaxOS::processes::SharedMessageEndpoint::write().