Welcome! Log In Create A New Profile

Advanced

Why ngx_trylock do extra judgement?

贾凯
July 19, 2014 05:58AM
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 ?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Why ngx_trylock do extra judgement?

贾凯 July 19, 2014 05:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready