Task Scheduler
f3c51100
|
Syncronization Functions. More...
Functions | |
TASH_SCH_EXTERN schSignalSet * | schCreateSignal (void) |
TASH_SCH_EXTERN int | schDeleteSignal (schSignalSet *signal) |
TASH_SCH_EXTERN int | schBaseSignal (void) |
TASH_SCH_EXTERN int | schSignalWait (schSignalSet *sig) |
Wait in till signal has been issued. More... | |
TASH_SCH_EXTERN int | schSignalWaitTimeOut (schSignalSet *sig, long int nanoseconds) |
TASH_SCH_EXTERN int | schSetSignalThreadMask (schSignalSet *set, int nr, const int *signals) |
TASH_SCH_EXTERN int | schCreateMutex (schMutex **mutex) |
TASH_SCH_EXTERN int | schCreateSpinLock (schSpinLock **spinlock) |
Creates a spinlock synchronization primitive object. More... | |
TASH_SCH_EXTERN int | schCreateSemaphore (schSemaphore **pSemaphore) |
TASH_SCH_EXTERN int | schCreateBarrier (schBarrier **pBarrier) |
Create Memory barrier. More... | |
TASH_SCH_EXTERN int | schInitBarrier (schBarrier *pBarrier, int count) |
TASH_SCH_EXTERN int | schDeleteBarrier (schBarrier *barrier) |
TASH_SCH_EXTERN int | schWaitBarrier (schBarrier *barrier) |
Wait for the barrier to finish. More... | |
TASH_SCH_EXTERN int | schCreateConditional (schConditional **pCondVariable) |
TASH_SCH_EXTERN int | schDeleteConditional (schConditional *conditional) |
TASH_SCH_EXTERN int | schConditionalWait (schConditional *conditional, schMutex *mutex) |
TASH_SCH_EXTERN int | schConditionalSignal (schConditional *conditional) |
TASH_SCH_EXTERN int | schCreateRWLock (schRWLock **pRwLock) |
TASH_SCH_EXTERN int | schDeleteRWLock (schRWLock *rwLock) |
TASH_SCH_EXTERN int | schRWLockRead (schRWLock *rwLock) |
TASH_SCH_EXTERN int | schRWLockWrite (schRWLock *rwLock) |
TASH_SCH_EXTERN int | schRWLocUnLock (schRWLock *rwLock) |
TASH_SCH_EXTERN int | schDeleteMutex (schMutex *mutex) |
Release resources associated with the mutex object. More... | |
TASH_SCH_EXTERN int | schDeleteSpinLock (schSpinLock *spinlock) |
Release spinlock resources. More... | |
TASH_SCH_EXTERN int | schDeleteSemaphore (schSemaphore *pSemaphore) |
Delete semaphore. More... | |
TASH_SCH_EXTERN int | schMutexLock (schMutex *mutexLock) |
Lock mutex and wait initill it has been unlocked for the thread to use the mutex. More... | |
TASH_SCH_EXTERN int | schMutexTryLock (schMutex *mutex, long int timeout) |
Attempt to lock the mutex. If the wait time exceeds the timeout it will return with the status of timeout. More... | |
TASH_SCH_EXTERN int | schMutexUnLock (schMutex *mutexLock) |
Unlock mutex. More... | |
TASH_SCH_EXTERN int | schSemaphoreWait (schSemaphore *pSemaphore) |
Wait for semaphore to be unlocked. More... | |
TASH_SCH_EXTERN int | schSemaphoreTryWait (schSemaphore *semaphore) |
TASH_SCH_EXTERN int | schSemaphoreTimedWait (schSemaphore *pSemaphore, long int timeout) |
TASH_SCH_EXTERN int | schSemaphorePost (schSemaphore *pSemaphore) |
TASH_SCH_EXTERN int | schSemaphoreValue (schSemaphore *pSemaphore, int *value) |
TASH_SCH_EXTERN int | schLockSpinLock (schSpinLock *spinlock) |
TASH_SCH_EXTERN int | schTryLockSpinLock (schSpinLock *spinLock) |
TASH_SCH_EXTERN int | schUnlockSpinLock (schSpinLock *spinlock) |
Syncronization Functions.
TASH_SCH_EXTERN schSignalSet* schCreateSignal | ( | void | ) |
Allocate signal object.
TASH_SCH_EXTERN int schDeleteSignal | ( | schSignalSet * | signal | ) |
Release signal resources.
signal | valid signal pointer. |
TASH_SCH_EXTERN int schBaseSignal | ( | void | ) |
Get the base signal number that are valid for sending signal between threads and that will not conflicts with the kernel specified signals.
TASH_SCH_EXTERN int schSignalWait | ( | schSignalSet * | sig | ) |
Wait in till signal has been issued.
sig | signal object. |
TASH_SCH_EXTERN int schSignalWaitTimeOut | ( | schSignalSet * | sig, |
long int | nanoseconds | ||
) |
Wait in till a signal has been issued in the timeout time frame.
sig | signal object. |
nanoseconds | in nano seconds for the timeout. |
TASH_SCH_EXTERN int schSetSignalThreadMask | ( | schSignalSet * | set, |
int | nr, | ||
const int * | signals | ||
) |
Set thread signal mask. Mask what signal to listen and how to
set | object. |
nr | number of signals. |
signals | array of valid signals. |
TASH_SCH_EXTERN int schCreateMutex | ( | schMutex ** | mutex | ) |
Create mutex pointer.
mutex | non-null pointer to mutex pointer. |
TASH_SCH_EXTERN int schCreateSpinLock | ( | schSpinLock ** | spinlock | ) |
Creates a spinlock synchronization primitive object.
The Synchronization primitive works by using a thight for loop and check if still locked or if has been unlocked and can proceeded.
Use this synchronization primitive when the lock is suspected to be very short or if to prevent the kernel from switching the process directly.
spinlock | valid pointer. |
TASH_SCH_EXTERN int schCreateSemaphore | ( | schSemaphore ** | pSemaphore | ) |
Create semaphore object.
pSemaphore | valid pointer. |
TASH_SCH_EXTERN int schCreateBarrier | ( | schBarrier ** | pBarrier | ) |
Create Memory barrier.
pBarrier | valid pointer. |
TASH_SCH_EXTERN int schInitBarrier | ( | schBarrier * | pBarrier, |
int | count | ||
) |
pBarrier | |
count |
TASH_SCH_EXTERN int schDeleteBarrier | ( | schBarrier * | barrier | ) |
barrier |
TASH_SCH_EXTERN int schWaitBarrier | ( | schBarrier * | barrier | ) |
Wait for the barrier to finish.
barrier |
TASH_SCH_EXTERN int schCreateConditional | ( | schConditional ** | pCondVariable | ) |
pCondVariable |
TASH_SCH_EXTERN int schDeleteConditional | ( | schConditional * | conditional | ) |
conditional |
TASH_SCH_EXTERN int schConditionalWait | ( | schConditional * | conditional, |
schMutex * | mutex | ||
) |
conditional | |
mutex |
TASH_SCH_EXTERN int schConditionalSignal | ( | schConditional * | conditional | ) |
conditional |
TASH_SCH_EXTERN int schCreateRWLock | ( | schRWLock ** | pRwLock | ) |
pRwLock |
TASH_SCH_EXTERN int schDeleteRWLock | ( | schRWLock * | rwLock | ) |
rwLock |
TASH_SCH_EXTERN int schRWLockRead | ( | schRWLock * | rwLock | ) |
rwLock |
TASH_SCH_EXTERN int schRWLockWrite | ( | schRWLock * | rwLock | ) |
rwLock |
TASH_SCH_EXTERN int schRWLocUnLock | ( | schRWLock * | rwLock | ) |
rwLock |
TASH_SCH_EXTERN int schDeleteMutex | ( | schMutex * | mutex | ) |
Release resources associated with the mutex object.
mutex | valid mutex object pointer. |
TASH_SCH_EXTERN int schDeleteSpinLock | ( | schSpinLock * | spinlock | ) |
Release spinlock resources.
spinlock | valid spinlock pointer. |
TASH_SCH_EXTERN int schDeleteSemaphore | ( | schSemaphore * | pSemaphore | ) |
Delete semaphore.
pSemaphore | valid pointer. |
TASH_SCH_EXTERN int schMutexLock | ( | schMutex * | mutexLock | ) |
Lock mutex and wait initill it has been unlocked for the thread to use the mutex.
mutexLock | valid mutex pointer. |
TASH_SCH_EXTERN int schMutexTryLock | ( | schMutex * | mutex, |
long int | timeout | ||
) |
Attempt to lock the mutex. If the wait time exceeds the timeout it will return with the status of timeout.
mutex | valid mutex pointer object. |
timeout | number of nanoseconds that it will wait. |
TASH_SCH_EXTERN int schMutexUnLock | ( | schMutex * | mutexLock | ) |
Unlock mutex.
mutexLock | valid mutex pointer. |
TASH_SCH_EXTERN int schSemaphoreWait | ( | schSemaphore * | pSemaphore | ) |
Wait for semaphore to be unlocked.
If the counter is it will block and wait for the schSemaphorePost function to be wait. Otherwise it will continue execution while blocking any other thread passing the wait function in till the schSemaphorePost. function is invoked. Wait in till the semaphore has been unlocked.
pSemaphore | valid semaphore object. |
TASH_SCH_EXTERN int schSemaphoreTryWait | ( | schSemaphore * | semaphore | ) |
Similar to schSemaphoreWait execpet it won't be blocking if blocked by other semaphore and will return status that it is timed out.
semaphore | valid semaphore object. |
TASH_SCH_EXTERN int schSemaphoreTimedWait | ( | schSemaphore * | pSemaphore, |
long int | timeout | ||
) |
Wait for the semaphore has been unlocked for a explicit duration of time in nanoseconds.
pSemaphore | valid semaphore object. |
timeout | non-negative time in nanoseconds. |
TASH_SCH_EXTERN int schSemaphorePost | ( | schSemaphore * | pSemaphore | ) |
Function will decrease the counter and let next first waiting semaphore continue while looking the remaining waiting semaphore.
pSemaphore | valid semaphore object. |
TASH_SCH_EXTERN int schSemaphoreValue | ( | schSemaphore * | pSemaphore, |
int * | value | ||
) |
Get current value of the semaphore.
pSemaphore | valid semaphore object. |
value |
TASH_SCH_EXTERN int schLockSpinLock | ( | schSpinLock * | spinlock | ) |
Lock spinlock.
spinlock | valid spinlock pointer. |
TASH_SCH_EXTERN int schTryLockSpinLock | ( | schSpinLock * | spinLock | ) |
Attempt to lock the spinlock. If failed it will return directly rather than wait.
spinLock | valid spinlock pointer object. |
TASH_SCH_EXTERN int schUnlockSpinLock | ( | schSpinLock * | spinlock | ) |
Unlock spinlock.
spinlock | valid spinlock pointer. |