Changeset 1b20da0 in mainline for uspace/lib/c/include/rcu.h
- Timestamp:
- 2018-02-28T17:52:03Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/rcu.h
rdf6ded8 r1b20da0 41 41 #include <stdbool.h> 42 42 43 /** Use to assign a pointer to newly initialized data to a rcu reader 43 /** Use to assign a pointer to newly initialized data to a rcu reader 44 44 * accessible pointer. 45 * 45 * 46 46 * Example: 47 47 * @code … … 50 50 * int grade; 51 51 * } exam_t; 52 * 52 * 53 53 * exam_t *exam_list; 54 54 * // .. 55 * 55 * 56 56 * // Insert at the beginning of the list. 57 57 * exam_t *my_exam = malloc(sizeof(exam_t), 0); … … 59 59 * my_exam->next = exam_list; 60 60 * rcu_assign(exam_list, my_exam); 61 * 61 * 62 62 * // Changes properly propagate. Every reader either sees 63 63 * // the old version of exam_list or the new version with … … 65 65 * rcu_synchronize(); 66 66 * // Now we can be sure every reader sees my_exam. 67 * 67 * 68 68 * @endcode 69 69 */ … … 75 75 76 76 /** Use to access RCU protected data in a reader section. 77 * 77 * 78 78 * Example: 79 79 * @code 80 80 * exam_t *exam_list; 81 81 * // ... 82 * 82 * 83 83 * rcu_read_lock(); 84 84 * exam_t *first_exam = rcu_access(exam_list); 85 * // We can now safely use first_exam, it won't change 85 * // We can now safely use first_exam, it won't change 86 86 * // under us while we're using it. 87 87 *
Note:
See TracChangeset
for help on using the changeset viewer.