MCPcopy Create free account
hub / github.com/acl-dev/acl / pthread_mutex_trylock

Function pthread_mutex_trylock

lib_fiber/c/src/common/pthread_patch.c:359–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359int pthread_mutex_trylock(pthread_mutex_t *mutex)
360{
361 const char *myname = "pthread_mutex_trylock";
362 DWORD ret;
363
364 if (mutex == NULL) {
365 msg_error("%s, %s(%d): input invalid",
366 __FILE__, myname, __LINE__);
367 return -1;
368 }
369
370 ret = WaitForSingleObject(mutex->id, 0);
371 if (ret == WAIT_TIMEOUT) {
372 return FIBER_ETIME;
373 } else if (ret == WAIT_FAILED) {
374 msg_error("%s, %s(%d): WaitForSingleObject error(%s)",
375 __FILE__, myname, __LINE__, last_serror());
376 return -1;
377 }
378
379 return 0;
380}
381
382int pthread_mutex_unlock(pthread_mutex_t *mutex)
383{

Callers 6

test_lockFunction · 0.85
fiber_mutex_lock_onceFunction · 0.85
fiber_mutex_lock_tryFunction · 0.85
acl_fiber_mutex_trylockFunction · 0.85
lockMethod · 0.85
mysql_thread.hFile · 0.85

Calls 2

msg_errorFunction · 0.70
last_serrorFunction · 0.70

Tested by 1

test_lockFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…