diff --git a/src/knot/ctl/commands.c b/src/knot/ctl/commands.c index e3b8d70d3ad13f065de4007d0c32feb9beb5ffd0..99533a78cc75d80dd71ea2b5b7ca050fc7c52b2a 100644 --- a/src/knot/ctl/commands.c +++ b/src/knot/ctl/commands.c @@ -2425,10 +2425,18 @@ static int ctl_lock(server_t *server, ctl_lock_flag_t flags, uint64_t timeout_ms if ((flags & CTL_LOCK_SRV_W)) { assert(!(flags & CTL_LOCK_SRV_R)); +#if !defined(__APPLE__) ret = pthread_rwlock_timedwrlock(&server->ctl_lock, &ts); +#else + ret = pthread_rwlock_wrlock(&server->ctl_lock); +#endif } if ((flags & CTL_LOCK_SRV_R)) { +#if !defined(__APPLE__) ret = pthread_rwlock_timedrdlock(&server->ctl_lock, &ts); +#else + ret = pthread_rwlock_rdlock(&server->ctl_lock); +#endif } return (ret != 0 ? KNOT_EBUSY : KNOT_EOK); }