Skip to content

Commit

Permalink
cmap: Explain corner case in CMAP_FOR_EACH comment.
Browse files Browse the repository at this point in the history
Commit d916785("dpif-netdev: Fix improper use of CMAP_FOR_EACH.")
fixes a problem that's worth documenting.

Requested-by: Jarno Rajahalme <[email protected]>
Signed-off-by: Daniele Di Proietto <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
ddiproietto committed Feb 4, 2016
1 parent e6448d2 commit 25c7da8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/cmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ unsigned long cmap_find_batch(const struct cmap *cmap, unsigned long map,
* node being deleted may be visited once or not at all. Other nodes
* will be visited once.)
*
* - If the cmap is changing, it is not safe to quiesce while iterating.
* Even if the changes are done by the same thread that's performing the
* iteration (Corollary: it is not safe to call cmap_remove() and quiesce
* in the loop body).
*
*
* Example
* =======
Expand Down

0 comments on commit 25c7da8

Please sign in to comment.