Loading...
Searching...
No Matches
vspace::internals::FastLock Class Reference

`#include <vspace.h>`

## Public Member Functions

| FastLock (vaddr_t offset=0)
void | lock ()
void | unlock ()

## Private Attributes

vaddr_t | _offset

## Detailed Description

Definition at line 1431 of file vspace.h.

## Constructor & Destructor Documentation

## FastLock()

vspace::internals::FastLock::FastLock | ( | vaddr_t | offset = 0 | ) |

inline

Definition at line 1445 of file vspace.h.

: _offset(offset) {
}
vspace::internals::FastLock::_offset
vaddr_t _offset
Definition vspace.h:1437
offset
STATIC_VAR int offset
Definition janet.cc:29

## Member Function Documentation

## lock()

void vspace::internals::FastLock::lock | ( |  | ) |

Definition at line 727 of file vspace.cc.

{
#ifdef HAVE_CPP_THREADS
while (_lock.test_and_set()) {
}
bool empty = _owner < 0;
if (empty) {
_owner = vmem.current_process;
} else {
int p = vmem.current_process;
vmem.metapage->process_info[p].next = -1;
if (_head < 0)
_head = p;
else
vmem.metapage->process_info[_tail].next = p;
_tail = p;
}
_lock.clear();
if (!empty)
wait_signal(false);
#else
lock_file(vmem.fd, _offset);
#endif
}
p
int p
Definition cfModGcd.cc:4086
vspace::internals::Mutex::_lock
vaddr_t _lock
Definition vspace.h:1710
vspace::internals::Mutex::_owner
int _owner
Definition vspace.h:1708
vspace::internals::lock_file
void lock_file(int fd, size_t offset, size_t len)
Definition vspace.cc:913
vspace::internals::wait_signal
ipc_signal_t wait_signal(bool lock)
Definition vspace.cc:1075
vspace::internals::vmem
static VMem & vmem
Definition vspace.h:1635
vspace::internals::MetaPage::process_info
ProcessInfo process_info[MAX_PROCESS]
Definition vspace.h:1513
vspace::internals::VMem::metapage
MetaPage * metapage
Definition vspace.h:1589
vspace::internals::VMem::fd
int fd
Definition vspace.h:1590
vspace::internals::VMem::current_process
int current_process
Definition vspace.h:1592

## unlock()

void vspace::internals::FastLock::unlock | ( |  | ) |

Definition at line 751 of file vspace.cc.

{
#ifdef HAVE_CPP_THREADS
while (_lock.test_and_set()) {
}
_owner = _head;
if (_owner >= 0)
_head = vmem.metapage->process_info[_head].next;
_lock.clear();
if (_owner >= 0)
send_signal(_owner, 0, false);
#else
unlock_file(vmem.fd, _offset);
#endif
}
vspace::internals::unlock_file
void unlock_file(int fd, size_t offset, size_t len)
Definition vspace.cc:919
vspace::internals::send_signal
bool send_signal(int processno, ipc_signal_t sig, bool lock)
Definition vspace.cc:967

## Field Documentation

## _offset

vaddr_t vspace::internals::FastLock::_offset

private

Definition at line 1437 of file vspace.h.

The documentation for this class was generated from the following files:

- kernel/oswrapper/vspace.h
- kernel/oswrapper/vspace.cc