My Project
Public Member Functions | Private Attributes
vspace::internals::Mutex Class Reference

#include <vspace.h>

Public Member Functions

 Mutex ()
 
 ~Mutex ()
 
void lock ()
 
void unlock ()
 

Private Attributes

int _owner
 
int _locklevel
 
vaddr_t _lock
 

Detailed Description

Definition at line 1706 of file vspace.h.

Constructor & Destructor Documentation

◆ Mutex()

vspace::internals::Mutex::Mutex ( )
inline

Definition at line 1713 of file vspace.h.

1713  : _owner(-1), _locklevel(0), _lock(vmem_alloc(1)) {
1714  }
vaddr_t vmem_alloc(size_t size)
Definition: vspace.cc:800

◆ ~Mutex()

vspace::internals::Mutex::~Mutex ( )
inline

Definition at line 1715 of file vspace.h.

1715  {
1716  vmem_free(_lock);
1717  }
void vmem_free(vaddr_t vaddr)
Definition: vspace.cc:752

Member Function Documentation

◆ lock()

void vspace::internals::Mutex::lock ( )
inline

Definition at line 1718 of file vspace.h.

1718  {
1719  if (_owner == vmem.current_process) {
1720  _locklevel++;
1721  } else {
1724  _locklevel = 1;
1725  }
1726  }
void lock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:851
static const size_t METABLOCK_SIZE
Definition: vspace.h:1420
static VMem & vmem
Definition: vspace.h:1635

◆ unlock()

void vspace::internals::Mutex::unlock ( )
inline

Definition at line 1727 of file vspace.h.

1727  {
1728  if (--_locklevel == 0) {
1730  _owner = -1;
1732  }
1733  }
void unlock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:857
#define assert(A)
Definition: svd_si.h:3

Field Documentation

◆ _lock

vaddr_t vspace::internals::Mutex::_lock
private

Definition at line 1710 of file vspace.h.

◆ _locklevel

int vspace::internals::Mutex::_locklevel
private

Definition at line 1709 of file vspace.h.

◆ _owner

int vspace::internals::Mutex::_owner
private

Definition at line 1708 of file vspace.h.


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