My Project
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.

1445 : _offset(offset) {
1446 }
STATIC_VAR int offset
Definition janet.cc:29

Member Function Documentation

◆ lock()

Definition at line 748 of file vspace.cc.

748 {
749#ifdef HAVE_CPP_THREADS
750 while (_lock.test_and_set()) {
751 }
752 bool empty = _owner < 0;
753 if (empty) {
755 } else {
756 int p = vmem.current_process;
757 vmem.metapage->process_info[p].next = -1;
758 if (_head < 0)
759 _head = p;
760 else
761 vmem.metapage->process_info[_tail].next = p;
762 _tail = p;
763 }
764 _lock.clear();
765 if (!empty)
766 wait_signal(false);
767#else
769#endif
770}
int p
Definition cfModGcd.cc:4086
void lock_file(int fd, size_t offset, size_t len)
Definition vspace.cc:934
ipc_signal_t wait_signal(bool lock)
Definition vspace.cc:1102
static VMem & vmem
Definition vspace.h:1635
ProcessInfo process_info[MAX_PROCESS]
Definition vspace.h:1513

◆ unlock()

Definition at line 772 of file vspace.cc.

772 {
773#ifdef HAVE_CPP_THREADS
774 while (_lock.test_and_set()) {
775 }
776 _owner = _head;
777 if (_owner >= 0)
778 _head = vmem.metapage->process_info[_head].next;
779 _lock.clear();
780 if (_owner >= 0)
781 send_signal(_owner, 0, false);
782#else
784#endif
785}
void unlock_file(int fd, size_t offset, size_t len)
Definition vspace.cc:940
bool send_signal(int processno, ipc_signal_t sig, bool lock)
Definition vspace.cc:994

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: