My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
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()

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

Definition at line 681 of file vspace.cc.

681 {
682#ifdef HAVE_CPP_THREADS
683 while (_lock.test_and_set()) {
684 }
685 bool empty = _owner < 0;
686 if (empty) {
687 _owner = vmem.current_process;
688 } else {
689 int p = vmem.current_process;
690 vmem.metapage->process_info[p].next = -1;
691 if (_head < 0)
692 _head = p;
693 else
694 vmem.metapage->process_info[_tail].next = p;
695 _tail = p;
696 }
697 _lock.clear();
698 if (!empty)
699 wait_signal(false);
700#else
702#endif
703}
int p
Definition: cfModGcd.cc:4078
void lock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:867
ipc_signal_t wait_signal(bool lock)
Definition: vspace.cc:987
static VMem & vmem
Definition: vspace.h:1635
ProcessInfo process_info[MAX_PROCESS]
Definition: vspace.h:1513
MetaPage * metapage
Definition: vspace.h:1589

◆ unlock()

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

Definition at line 705 of file vspace.cc.

705 {
706#ifdef HAVE_CPP_THREADS
707 while (_lock.test_and_set()) {
708 }
709 _owner = _head;
710 if (_owner >= 0)
711 _head = vmem.metapage->process_info[_head].next;
712 _lock.clear();
713 if (_owner >= 0)
714 send_signal(_owner, 0, false);
715#else
717#endif
718}
void unlock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:873
bool send_signal(int processno, ipc_signal_t sig, bool lock)
Definition: vspace.cc:921

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: