mutek/semaphore.h header reference
[Kernel services module]

The source code of this header can be browsed online.

Description [link] 

Kernel semaphore service

Members [link] 

Types [link] 

Functions [link] 

Members detail [link] 

#define GCT_CONTAINER_ALGO_semaphore_wait [link] 

This macro is declared in mutek/semaphore.h source file, line 45.

#define MUTEK_SEMAPHORE_H_ [link] 

This macro is declared in mutek/semaphore.h source file, line 23.

void semaphore_barrier(struct semaphore_s *semaphore, semaphore_value_t n) [link] 

This function is declared in mutek/semaphore.h source file, line 119.

This function consumes the specified amount from the semaphore internal counter and suspends the execution of the caller only if the counter is currently larger than specified. In the other case, all waiter are resumed and the internal counter is restored to its initial value.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

void semaphore_destroy(struct semaphore_s *semaphore) [link] 

This function is declared in mutek/semaphore.h source file, line 78.

This function releases the resources used by the semaphore

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

void semaphore_give(struct semaphore_s *semaphore, semaphore_value_t n) [link] 

This function is declared in mutek/semaphore.h source file, line 106.

This function increases the internal counter by the specified amount then serves suspended threads in blocking order.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

void semaphore_give_any(struct semaphore_s *semaphore, semaphore_value_t n) [link] 

This function is declared in mutek/semaphore.h source file, line 111.

This function increases the internal counter by the specified amount then serves any suspended threads with a low enough remaining amount.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

error_t semaphore_init(struct semaphore_s *semaphore, semaphore_value_t value) [link] 

This function is declared in mutek/semaphore.h source file, line 74.

This function initializes a semaphore object and set its internal counter to the specified value.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

void semaphore_poll_init(struct semaphore_poll_s poll[], size_t count, struct semaphore_s *sem) [link] 

This function is declared in mutek/semaphore.h source file, line 158.

This function initializes an array of struct semaphore_poll_s objects. This can be used to implement a primitive similar to unix poll which waits for multiple asynchronous operations to terminate.

Some helpers are provided to wait for termination of device requests. More helpers can be implemented in order to handle any kind of asynchronous event.

See examples/poll_sem

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

struct semaphore_poll_s [link] 

This struct is declared in device/request.h source file, line 335.

Preprocessor condition: defined( CONFIG_MUTEK_SEMAPHORE )

See also semaphore_poll_init.

FieldDescription
struct semaphore_s * sem;
semaphore_value_t value;

struct semaphore_s [link] 

This struct is declared in mutek/semaphore.h source file, line 63.

Semaphore object structure

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

See also sem_t.

void semaphore_take(struct semaphore_s *semaphore, semaphore_value_t n) [link] 

This function is declared in mutek/semaphore.h source file, line 85.

This function consumes the specified amount from the semaphore internal counter. If the current value of the counter is not large enough, the execution of the calling thread is suspended until the remaining amount becomes available.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

semaphore_value_t semaphore_take_any(struct semaphore_s *semaphore) [link] 

This function is declared in mutek/semaphore.h source file, line 96.

This function suspends the execution of the caller until the semaphore internal counter is greater than 0. It then resets the counter to 0 and returns the previously observed value.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

error_t semaphore_try_take(struct semaphore_s *semaphore, semaphore_value_t n) [link] 

This function is declared in mutek/semaphore.h source file, line 90.

This function successes only if the semaphore internal counter is at least n. In this case it subtracts n from the semaphore counter an returns 0.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

semaphore_value_t semaphore_try_take_any(struct semaphore_s *semaphore) [link] 

This function is declared in mutek/semaphore.h source file, line 101.

This function resets the semaphore internal counter to 0 and returns the previously observed value.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

semaphore_value_t semaphore_value(struct semaphore_s *semaphore) [link] 

This function is declared in mutek/semaphore.h source file, line 127.

This function returns the current value of the semaphore counter if greater than 0. In the other case, this function returns a null or negative value which indicates the counter amount needed to unblock all waiters which have called the semaphore_take function.

This is available when CONFIG_MUTEK_SEMAPHORE is defined.

typedef intptr_t semaphore_value_t [link] 

This typedef is declared in mutek/semaphore.h source file, line 44.

Type for the semaphore valueing

typedef void * semaphore_wait_entry_t [link] 

This typedef is declared in mutek/semaphore.h source file, line 57.

Preprocessor condition: defined( CONFIG_MUTEK_SEMAPHORE )

typedef struct semaphore_wait_s * semaphore_wait_item_t [link] 

This typedef is declared in mutek/semaphore.h source file, line 57.

Preprocessor condition: defined( CONFIG_MUTEK_SEMAPHORE )

typedef void * semaphore_wait_root_t [link] 

This typedef is declared in mutek/semaphore.h source file, line 57.

Preprocessor condition: defined( CONFIG_MUTEK_SEMAPHORE )

struct semaphore_wait_s [link] 

This struct is declared in mutek/semaphore.h source file, line 51.

Semaphore wait object, allocated on waiter stack

This struct is for internal use only.

Preprocessor condition: defined( CONFIG_MUTEK_SEMAPHORE )

FieldDescription
struct sched_context_s * sched_ctx;
semaphore_value_t value;

See also semaphore_wait_item_t.

Valid XHTML 1.0 StrictGenerated by diaxen on Thu Aug 4 15:44:06 2022 using MkDoc