Skip to content

Commit 9181743

Browse files
committed
fix(umc): skip mtx locking in umc_get_inc w/o ctx
1 parent 14dc52c commit 9181743

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/umcounters.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ umc_inc(umc_t *c, uint64_t val)
144144
umc_t *
145145
umc_get_inc(umc_ctx_t *ctx, const char *id, uint64_t val, bool lock)
146146
{
147-
if (lock) {
147+
if (lock && ctx) {
148148
pthread_mutex_lock(&ctx->mtx);
149149
}
150150

@@ -155,7 +155,7 @@ umc_get_inc(umc_ctx_t *ctx, const char *id, uint64_t val, bool lock)
155155
pthread_mutex_unlock(&c->mtx);
156156
}
157157

158-
if (lock) {
158+
if (lock && ctx) {
159159
pthread_mutex_unlock(&ctx->mtx);
160160
}
161161

0 commit comments

Comments
 (0)