MentOS  0.8.0
The Mentoring Operating System
Functions
spinlock.c File Reference

Functions

void spinlock_init (spinlock_t *spinlock)
 Initialize the spinlock. More...
 
void spinlock_lock (spinlock_t *spinlock)
 Try to lock the spinlock. More...
 
void spinlock_unlock (spinlock_t *spinlock)
 Try to unlock the spinlock. More...
 
int spinlock_trylock (spinlock_t *spinlock)
 Try to unlock the spinlock. More...
 

Detailed Description

Function Documentation

◆ spinlock_init()

void spinlock_init ( spinlock_t spinlock)

Initialize the spinlock.

Parameters
spinlockThe spinlock we initialize.

◆ spinlock_lock()

void spinlock_lock ( spinlock_t spinlock)

Try to lock the spinlock.

Parameters
spinlockThe spinlock we lock.

◆ spinlock_trylock()

int spinlock_trylock ( spinlock_t spinlock)

Try to unlock the spinlock.

Parameters
spinlockThe spinlock we try to block.
Returns
1 if succeeded, 0 otherwise.

◆ spinlock_unlock()

void spinlock_unlock ( spinlock_t spinlock)

Try to unlock the spinlock.

Parameters
spinlockThe spinlock we unlock.