Hi there, function ngx_shmtx_lock: if (*mtx->lock == 0 && ngx_atomic_cmp_set(mtx->lock, 0, ngx_pid)) and ngx_trylock (ngx_atomic.h): (*(lock) == 0 && ngx_atomic_cmp_set(lock, 0, 1)) I think ngx_atomic_cmp_set is enough, why Nginx do extra judgement ahead of it ?