Lines Matching refs:mr
1267 lws_mutex_refcount_init(struct lws_mutex_refcount *mr)
1269 pthread_mutex_init(&mr->lock, NULL);
1270 mr->last_lock_reason = NULL;
1271 mr->lock_depth = 0;
1272 mr->metadata = 0;
1276 memset(&mr->lock_owner, 0, sizeof(pthread_t));
1278 mr->lock_owner = 0;
1283 lws_mutex_refcount_destroy(struct lws_mutex_refcount *mr)
1285 pthread_mutex_destroy(&mr->lock);
1289 lws_mutex_refcount_lock(struct lws_mutex_refcount *mr, const char *reason)
1304 if (pthread_equal(mr->lock_owner, pthread_self()))
1306 if (mr->lock_owner == pthread_self())
1310 mr->lock_depth++;
1314 pthread_mutex_lock(&mr->lock);
1316 mr->last_lock_reason = reason;
1317 mr->lock_owner = pthread_self();
1318 mr->lock_depth = 1;
1319 //lwsl_notice("tid %d: lock %s\n", mr->tid, reason);
1323 lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr)
1325 if (--mr->lock_depth)
1329 mr->last_lock_reason = "free";
1333 memset(&mr->lock_owner, 0, sizeof(pthread_t));
1335 mr->lock_owner = 0;
1337 // lwsl_notice("tid %d: unlock %s\n", mr->tid, mr->last_lock_reason);
1338 pthread_mutex_unlock(&mr->lock);
1342 lws_mutex_refcount_assert_held(struct lws_mutex_refcount *mr)
1347 assert(pthread_equal(mr->lock_owner, pthread_self()) && mr->lock_depth);
1349 assert(mr->lock_owner == pthread_self() && mr->lock_depth);