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 |
void _bt_semaphore_init | ( | struct bt_semaphore * | sema, | |
int | initial | |||
) |
Initializes a bt_semaphore
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
sema | Pointer to the bt_semaphore |
int _bt_semaphore_postinc | ( | struct bt_semaphore * | sema, | |
int | val | |||
) |
Increase the number of free ressources by val
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
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.
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
sema | Pointer to the bt_semaphore |
void bt_semaphore_register_cmds | ( | void | ) |
Prints out the current value of all bt semaphores on the terminal