diff options
Diffstat (limited to 'src/osd/osdcore.h')
-rw-r--r-- | src/osd/osdcore.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index cd08fa8aa4e..0a4f351e5e9 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -440,6 +440,93 @@ osd_ticks_t osd_ticks_per_second(void); -----------------------------------------------------------------------------*/ void osd_sleep(osd_ticks_t duration); + + +/*************************************************************************** + SYNCHRONIZATION INTERFACES +***************************************************************************/ + +/* osd_lock is an opaque type which represents a recursive lock/mutex */ +struct osd_lock; + + +/*----------------------------------------------------------------------------- + osd_lock_alloc: allocate a new lock + + Parameters: + + None. + + Return value: + + A pointer to the allocated lock. +-----------------------------------------------------------------------------*/ +osd_lock *osd_lock_alloc(void); + + +/*----------------------------------------------------------------------------- + osd_lock_acquire: acquire a lock, blocking until it can be acquired + + Parameters: + + lock - a pointer to a previously allocated osd_lock. + + Return value: + + None. + + Notes: + + osd_locks are defined to be recursive. If the current thread already + owns the lock, this function should return immediately. +-----------------------------------------------------------------------------*/ +void osd_lock_acquire(osd_lock *lock); + + +/*----------------------------------------------------------------------------- + osd_lock_try: attempt to acquire a lock + + Parameters: + + lock - a pointer to a previously allocated osd_lock. + + Return value: + + TRUE if the lock was available and was acquired successfully. + FALSE if the lock was already in used by another thread. +-----------------------------------------------------------------------------*/ +int osd_lock_try(osd_lock *lock); + + +/*----------------------------------------------------------------------------- + osd_lock_release: release control of a lock that has been acquired + + Parameters: + + lock - a pointer to a previously allocated osd_lock. + + Return value: + + None. +-----------------------------------------------------------------------------*/ +void osd_lock_release(osd_lock *lock); + + +/*----------------------------------------------------------------------------- + osd_lock_free: free the memory and resources associated with an osd_lock + + Parameters: + + lock - a pointer to a previously allocated osd_lock. + + Return value: + + None. +-----------------------------------------------------------------------------*/ +void osd_lock_free(osd_lock *lock); + + + /*************************************************************************** WORK ITEM INTERFACES ***************************************************************************/ |