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 371 of file vspace.h.

Constructor & Destructor Documentation

◆ Mutex()

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

Definition at line 378 of file vspace.h.

378 : _owner(-1), _locklevel(0), _lock(vmem_alloc(1)) {
379 }
vaddr_t vmem_alloc(size_t size)
Definition: vspace.cc:243

◆ ~Mutex()

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

Definition at line 380 of file vspace.h.

380 {
382 }
void vmem_free(vaddr_t vaddr)
Definition: vspace.cc:195

Member Function Documentation

◆ lock()

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

Definition at line 383 of file vspace.h.

383 {
384 if (_owner == vmem.current_process) {
385 _locklevel++;
386 } else {
389 _locklevel = 1;
390 }
391 }
void lock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:294
static const size_t METABLOCK_SIZE
Definition: vspace.h:87
static VMem & vmem
Definition: vspace.h:300

◆ unlock()

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

Definition at line 392 of file vspace.h.

392 {
393 if (--_locklevel == 0) {
395 _owner = -1;
397 }
398 }
void unlock_file(int fd, size_t offset, size_t len)
Definition: vspace.cc:300
#define assert(A)
Definition: svd_si.h:3

Field Documentation

◆ _lock

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

Definition at line 375 of file vspace.h.

◆ _locklevel

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

Definition at line 374 of file vspace.h.

◆ _owner

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

Definition at line 373 of file vspace.h.


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