mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-07 03:48:46 +00:00
BUG/MINOR: hlua_fcn/queue: use atomic load to fetch queue size
In hlua_queue_size(), queue size is loaded as a regular int, but the queue might be shared by multiple threads that could perform some atomic pushing or popping attempts in parallel, so we better use an atomic load operation to guarantee consistent readings. This could be backported in 2.8.
This commit is contained in:
parent
3f1b901db8
commit
33a8c2842b
@ -542,7 +542,7 @@ static int hlua_queue_size(lua_State *L)
|
||||
struct hlua_queue *queue = hlua_check_queue(L, 1);
|
||||
|
||||
BUG_ON(!queue);
|
||||
lua_pushinteger(L, queue->size);
|
||||
lua_pushinteger(L, HA_ATOMIC_LOAD(&queue->size));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user