Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Spinlock Class Reference

A Spinlock allows locking of a section of code so that multiple processors cannot run it simultaneously. More...

#include <spinlock.h>

List of all members.

Public Member Functions

void init ()
void lock ()
bool try_lock ()
void unlock ()

Protected Attributes

bool locked


Detailed Description

A Spinlock allows locking of a section of code so that multiple processors cannot run it simultaneously.

Since multiple processors are not currently supported, spinlocks are not used yet.


Member Function Documentation

void Spinlock::init  )  [inline]
 

void Spinlock::lock  )  [inline]
 

Lock this spinlock. If it's already locked, busywait until it's available.

bool Spinlock::try_lock  )  [inline]
 

Attempt to lock this spinlock without busywaiting.

Return true on success and false otherwise.

void Spinlock::unlock  )  [inline]
 


Member Data Documentation

bool Spinlock::locked [protected]
 


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

Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman