Lines Matching refs:mtx
19 eMmutex_enter(eMmutex_t *mtx, char *file, int line) in eMmutex_enter() argument
23 mtx->eMm_owner); in eMmutex_enter()
24 if (mtx->eMm_magic != EMM_MAGIC) { in eMmutex_enter()
26 mtx->eMm_owner, mtx, mtx->eMm_magic); in eMmutex_enter()
29 if (mtx->eMm_held != 0) { in eMmutex_enter()
31 mtx->eMm_owner, mtx, mtx->eMm_held); in eMmutex_enter()
34 mtx->eMm_held++; in eMmutex_enter()
35 mtx->eMm_heldin = file; in eMmutex_enter()
36 mtx->eMm_heldat = line; in eMmutex_enter()
41 eMmutex_exit(eMmutex_t *mtx, char *file, int line) in eMmutex_exit() argument
45 mtx->eMm_owner); in eMmutex_exit()
46 if (mtx->eMm_magic != EMM_MAGIC) { in eMmutex_exit()
48 mtx->eMm_owner, mtx, mtx->eMm_magic); in eMmutex_exit()
51 if (mtx->eMm_held != 1) { in eMmutex_exit()
53 mtx->eMm_owner, mtx, mtx->eMm_held); in eMmutex_exit()
56 mtx->eMm_held--; in eMmutex_exit()
57 mtx->eMm_heldin = NULL; in eMmutex_exit()
58 mtx->eMm_heldat = 0; in eMmutex_exit()
63 eMmutex_init(eMmutex_t *mtx, char *who, char *file, int line) in eMmutex_init() argument
69 file, line, mtx, who); in eMmutex_init()
70 if (mtx->eMm_magic == EMM_MAGIC) { /* safe bet ? */ in eMmutex_init()
73 mtx->eMm_owner, mtx, mtx->eMm_magic); in eMmutex_init()
76 mtx->eMm_magic = EMM_MAGIC; in eMmutex_init()
77 mtx->eMm_held = 0; in eMmutex_init()
79 mtx->eMm_owner = strdup(who); in eMmutex_init()
81 mtx->eMm_owner = NULL; in eMmutex_init()
87 eMmutex_destroy(eMmutex_t *mtx, char *file, int line) in eMmutex_destroy() argument
92 mtx, mtx->eMm_owner); in eMmutex_destroy()
93 if (mtx->eMm_magic != EMM_MAGIC) { in eMmutex_destroy()
95 mtx->eMm_owner, mtx, mtx->eMm_magic); in eMmutex_destroy()
98 if (mtx->eMm_held != 0) { in eMmutex_destroy()
101 mtx->eMm_owner, mtx, mtx->eMm_held); in eMmutex_destroy()
104 if (mtx->eMm_owner != NULL) in eMmutex_destroy()
105 free(mtx->eMm_owner); in eMmutex_destroy()
106 memset(mtx, 0xa5, sizeof(*mtx)); in eMmutex_destroy()