comparison template/dw.c @ 1158:f86f556ff29d

Added dw_mutex_trylock() that functions like dw_mutex_lock() except it does not block if the mutex is already locked, it instead returns DW_MUTEX_TIMEOUT. Allowing threads to continue to do work while waiting to obtain a mutex.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 15 Sep 2011 21:13:59 +0000
parents 58b5374355ab
children 53547c9c99a2
comparison
equal deleted inserted replaced
1157:79bd0aff0bc2 1158:f86f556ff29d
3130 } 3130 }
3131 #endif 3131 #endif
3132 } 3132 }
3133 3133
3134 /* 3134 /*
3135 * Tries to gain access to the semaphore.
3136 * Parameters:
3137 * mutex: The handle to the mutex returned by dw_mutex_new().
3138 * Returns:
3139 * DW_ERROR_NONE on success, DW_ERROR_TIMEOUT if it is already locked.
3140 */
3141 int API dw_mutex_trylock(HMTX mutex)
3142 {
3143 return DW_ERROR_GENERAL;
3144 }
3145
3146 /*
3135 * Reliquishes the access to the semaphore. 3147 * Reliquishes the access to the semaphore.
3136 * Parameters: 3148 * Parameters:
3137 * mutex: The handle to the mutex returned by dw_mutex_new(). 3149 * mutex: The handle to the mutex returned by dw_mutex_new().
3138 */ 3150 */
3139 void dw_mutex_unlock(HMTX mutex) 3151 void dw_mutex_unlock(HMTX mutex)