My Project
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 676 of file vspace.cc.

676  {
677 #ifdef HAVE_CPP_THREADS
678  while (_lock.test_and_set()) {
679  }
680  bool empty = _owner < 0;
681  if (empty) {
682  _owner = vmem.current_process;
683  } else {
684  int p = vmem.current_process;
685  vmem.metapage->process_info[p].next = -1;
686  if (_head < 0)
687  _head = p;
688  else
689  vmem.metapage->process_info[_tail].next = p;
690  _tail = p;
691  }
692  _lock.clear();
693  if (!empty)
694  wait_signal(false);
695 #else
697 #endif
698 }
int p
Definition: cfModGcd.cc:4078
void lock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:850
ipc_signal_t wait_signal(bool lock)
Definition: vspace.cc:970
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 700 of file vspace.cc.

700  {
701 #ifdef HAVE_CPP_THREADS
702  while (_lock.test_and_set()) {
703  }
704  _owner = _head;
705  if (_owner >= 0)
706  _head = vmem.metapage->process_info[_head].next;
707  _lock.clear();
708  if (_owner >= 0)
709  send_signal(_owner, 0, false);
710 #else
712 #endif
713 }
void unlock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:856
bool send_signal(int processno, ipc_signal_t sig, bool lock)
Definition: vspace.cc:904

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: