mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 15:21:29 +02:00
DOC/MINOR: list: fixing MT_LIST_LOCK_ELT macro documentation
MT_LIST_LOCK_ELT macro was documented with an ambiguous usage restriction, implying that concurrent list deletion was not supported. But it seems that either the code has evolved, or the comment is wrong because the locking behavior implemented here is exactly the same one used in MT_LIST_DELETE, and no such restriction is described for MT_LIST_DELETE. I made some tests to make sure concurrent MT_LIST_DELETE (or deletion from mt_list_for_each_entry_safe) don't cause unexepected results. At the present time, this macro is not used, this fix only targets upcoming developments that might rely on this. No backport needed.
This commit is contained in:
parent
bcaa401646
commit
18c284c126
@ -604,10 +604,12 @@
|
|||||||
*/
|
*/
|
||||||
#define MT_LIST_INLIST(el) ((el)->next != (el))
|
#define MT_LIST_INLIST(el) ((el)->next != (el))
|
||||||
|
|
||||||
/* Lock an element in the list, to be sure it won't be removed.
|
/* Lock an element in the list, to be sure it won't be removed nor
|
||||||
* It needs to be synchronized somehow to be sure it's not removed
|
* accessed by another thread while the lock is held.
|
||||||
* from the list in the meanwhile.
|
* Locking behavior is inspired from MT_LIST_DELETE macro,
|
||||||
|
* thus this macro can safely be used concurrently with MT_LIST_DELETE.
|
||||||
* This returns a struct mt_list, that will be needed at unlock time.
|
* This returns a struct mt_list, that will be needed at unlock time.
|
||||||
|
* (using MT_LIST_UNLOCK_ELT)
|
||||||
*/
|
*/
|
||||||
#define MT_LIST_LOCK_ELT(_el) \
|
#define MT_LIST_LOCK_ELT(_el) \
|
||||||
({ \
|
({ \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user