Skip to content

Commit 65ded85

Browse files
committed
doc: ngx.semaphore: more description.
1 parent 9c131e6 commit 65ded85

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/ngx/semaphore.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ synchronize among each other very efficiently without constant polling and sleep
151151
"Light threads" in different contexts (like in different requests) can share the same
152152
semaphore instance as long as these "light threads" reside in the same NGINX worker
153153
process and the [lua_code_cache](https://github.com/openresty/lua-nginx-module#lua_code_cache)
154-
directive is turned on (which is the default).
154+
directive is turned on (which is the default). For inter-process "light thread" synchronization,
155+
it is recommended to use the [lua-resty-lock](https://github.com/openresty/lua-resty-lock) library instead
156+
(which is a bit less efficient than this semaphore API though).
157+
158+
This semaphore API has a pure userland implementation which does not involve any system calls nor
159+
block any operating system threads. It works closely with the event model of NGINX without
160+
introducing any extra delay.
155161

156162
Like other APIs provided by this `lua-resty-core` library, the LuaJIT FFI feature is required.
157163

0 commit comments

Comments
 (0)