#include <urcu.h>
#include <urcu/cds.h>
+#define POISON_PTR ((void *) 0x42UL)
+
/*
* External synchronization used.
*/
if (snode) {
struct test *node;
+ snode->next = POISON_PTR;
node = caa_container_of(snode,
struct test, list);
if (sync == TEST_SYNC_RCU)
cds_lfs_for_each_safe(head, snode, n) {
struct test *node;
+ snode->next = POISON_PTR;
node = caa_container_of(snode, struct test, list);
if (sync == TEST_SYNC_RCU)
call_rcu(&node->rcu, free_node_cb);
* __cds_lfs_pop needs to be synchronized using one of the following
* techniques:
*
- * 1) Calling __cds_lfs_pop under rcu read lock critical section. The
- * caller must wait for a grace period to pass before freeing the
- * returned node or modifying the cds_lfs_node structure.
+ * 1) Calling __cds_lfs_pop under rcu read lock critical section.
+ * Both __cds_lfs_pop and __cds_lfs_pop_all callers must wait for a
+ * grace period to pass before freeing the returned node or pushing
+ * the node back into the stack. It is valid to overwrite the content
+ * of cds_lfs_node immediately after __cds_lfs_pop and
+ * __cds_lfs_pop_all.
* 2) Using mutual exclusion (e.g. mutexes) to protect __cds_lfs_pop
* and __cds_lfs_pop_all callers.
* 3) Ensuring that only ONE thread can call __cds_lfs_pop() and
* matching the technique used to synchronize __cds_lfs_pop:
*
* 1) If __cds_lfs_pop is called under rcu read lock critical section,
- * both __cds_lfs_pop and cds_lfs_pop_all callers must wait for a
- * grace period to pass before freeing the returned node or modifying
- * the cds_lfs_node structure. However, no RCU read-side critical
- * section is needed around __cds_lfs_pop_all.
+ * both __cds_lfs_pop and __cds_lfs_pop_all callers must wait for a
+ * grace period to pass before freeing the returned node or pushing
+ * the node back into the stack. It is valid to overwrite the content
+ * of cds_lfs_node immediately after __cds_lfs_pop and
+ * __cds_lfs_pop_all. No RCU read-side critical section is needed
+ * around __cds_lfs_pop_all.
* 2) Using mutual exclusion (e.g. mutexes) to protect __cds_lfs_pop and
* __cds_lfs_pop_all callers.
* 3) Ensuring that only ONE thread can call __cds_lfs_pop() and
* __cds_lfs_pop needs to be synchronized using one of the following
* techniques:
*
- * 1) Calling __cds_lfs_pop under rcu read lock critical section. The
- * caller must wait for a grace period to pass before freeing the
- * returned node or modifying the cds_lfs_node structure.
+ * 1) Calling __cds_lfs_pop under rcu read lock critical section.
+ * Both __cds_lfs_pop and __cds_lfs_pop_all callers must wait for a
+ * grace period to pass before freeing the returned node or pushing
+ * the node back into the stack. It is valid to overwrite the content
+ * of cds_lfs_node immediately after __cds_lfs_pop and
+ * __cds_lfs_pop_all. No RCU read-side critical section is needed
+ * around __cds_lfs_pop_all.
* 2) Using mutual exclusion (e.g. mutexes) to protect __cds_lfs_pop
* and __cds_lfs_pop_all callers.
* 3) Ensuring that only ONE thread can call __cds_lfs_pop() and
* matching the technique used to synchronize __cds_lfs_pop:
*
* 1) If __cds_lfs_pop is called under rcu read lock critical section,
- * both __cds_lfs_pop and cds_lfs_pop_all callers must wait for a
- * grace period to pass before freeing the returned node or modifying
- * the cds_lfs_node structure. However, no RCU read-side critical
- * section is needed around __cds_lfs_pop_all.
+ * both __cds_lfs_pop and __cds_lfs_pop_all callers must wait for a
+ * grace period to pass before freeing the returned node or pushing
+ * the node back into the stack. It is valid to overwrite the content
+ * of cds_lfs_node immediately after __cds_lfs_pop and
+ * __cds_lfs_pop_all. No RCU read-side critical section is needed
+ * around __cds_lfs_pop_all.
* 2) Using mutual exclusion (e.g. mutexes) to protect __cds_lfs_pop and
* __cds_lfs_pop_all callers.
* 3) Ensuring that only ONE thread can call __cds_lfs_pop() and