Tries to lock an INKMutex
.
INKReturnCode InkMutexTryLock (INKMutex
mutex
, int
*is_mutex_lock
)
Tries to lock the INKMutex
mutex.
In general, use InkMutexTryLock
to obtain a
mutex (see the example below).
This API has been deprecated by
INKMutexLockTry
.
If the mutex was successfully locked, then 1 is returned.
If mutex is already locked, then 0 is returned.
int handler (INKCont contp, INKEvent event, void *edata) { //this continuation tries to grab a mutex int lock = InkMutexTryLock (mutex); if (!lock) { /* Schedule a retry; RETRY_TIME should be 10 ms or longer. */ INKContSchedule (contp, RETRY_TIME); return INK_EVENT_IMMEDIATE; } // Now the mutex is grabbed do_some_job ... INKMutexUnlock (mutexp); }