btnut/btnode/include/bt/bt_semaphore.h File Reference


Detailed Description

Implements mutex and bt_semaphores.

Author:
14:50:09 Mathias Payer <payerm@student.ethz.ch>
Date:
2004/05/07


Data Structures

struct  _bt_semaphore_list
struct  bt_semaphore
 Represents a bt_semaphore, a number of ressources that can be shared by many threads. More...

Functions

void _bt_semaphore_init (struct bt_semaphore *sema, int initial)
int _bt_semaphore_post (struct bt_semaphore *sema)
int _bt_semaphore_postinc (struct bt_semaphore *sema, int val)
int _bt_semaphore_postval (struct bt_semaphore *sema, int val)
int _bt_semaphore_trywait (struct bt_semaphore *sema)
int _bt_semaphore_wait (struct bt_semaphore *sema)
void bt_semaphore_register_cmds (void)

Variables

_bt_semaphore_list * _bt_semaphore_head


Function Documentation

void _bt_semaphore_init ( struct bt_semaphore sema,
int  initial 
)

Initializes a bt_semaphore

Parameters:
sema Pointer to the bt_semaphore
initial Initial value of the semaphore

int _bt_semaphore_post ( struct bt_semaphore sema  ) 

Increases the number of free ressources by 1

Parameters:
sema Pointer to the bt_semaphore

int _bt_semaphore_postinc ( struct bt_semaphore sema,
int  val 
)

Increase the number of free ressources by val

Parameters:
sema Pointer to the bt_semaphore
val Number of additional free ressources

int _bt_semaphore_postval ( struct bt_semaphore sema,
int  val 
)

Set the number of free ressources to val

Parameters:
sema Pointer to the bt_semaphore
val Number of free ressources

int _bt_semaphore_trywait ( struct bt_semaphore sema  ) 

If there are some ressources left, return one, if all ressources are taken, return an error.

Parameters:
sema Pointer to the bt_semaphore

int _bt_semaphore_wait ( struct bt_semaphore sema  ) 

If there are some ressources left, return one, if all ressources are taken, wait until a ressource gets freed

Parameters:
sema Pointer to the bt_semaphore

void bt_semaphore_register_cmds ( void   ) 

Prints out the current value of all bt semaphores on the terminal


Generated on Wed Apr 29 11:12:29 2009 for BTnut System Software by doxygen 1.5.1