|
39 | 39 | # define __assumes_shared_ctx_lock(...) __attribute__((assert_shared_capability(__VA_ARGS__))) |
40 | 40 |
|
41 | 41 | /** |
42 | | - * __guarded_by - struct member and globals attribute, declares variable |
43 | | - * only accessible within active context |
| 42 | + * __guarded_by() - struct member and globals attribute, declares variable |
| 43 | + * only accessible within active context |
| 44 | + * @...: context lock instance pointer(s) |
44 | 45 | * |
45 | 46 | * Declares that the struct member or global variable is only accessible within |
46 | | - * the context entered by the given context lock. Read operations on the data |
47 | | - * require shared access, while write operations require exclusive access. |
| 47 | + * the context entered by the given context lock(s). Read operations on the data |
| 48 | + * require shared access to at least one of the context locks, while write |
| 49 | + * operations require exclusive access to all listed context locks. |
48 | 50 | * |
49 | 51 | * .. code-block:: c |
50 | 52 | * |
51 | 53 | * struct some_state { |
52 | 54 | * spinlock_t lock; |
53 | 55 | * long counter __guarded_by(&lock); |
54 | 56 | * }; |
| 57 | + * |
| 58 | + * struct some_state { |
| 59 | + * spinlock_t lock1, lock2; |
| 60 | + * long counter __guarded_by(&lock1, &lock2); |
| 61 | + * }; |
55 | 62 | */ |
56 | 63 | # define __guarded_by(...) __attribute__((guarded_by(__VA_ARGS__))) |
57 | 64 |
|
58 | 65 | /** |
59 | | - * __pt_guarded_by - struct member and globals attribute, declares pointed-to |
60 | | - * data only accessible within active context |
| 66 | + * __pt_guarded_by() - struct member and globals attribute, declares pointed-to |
| 67 | + * data only accessible within active context |
| 68 | + * @...: context lock instance pointer(s) |
61 | 69 | * |
62 | 70 | * Declares that the data pointed to by the struct member pointer or global |
63 | 71 | * pointer is only accessible within the context entered by the given context |
64 | | - * lock. Read operations on the data require shared access, while write |
65 | | - * operations require exclusive access. |
| 72 | + * lock(s). Read operations on the data require shared access to at least one |
| 73 | + * of the context locks, while write operations require exclusive access to all |
| 74 | + * listed context locks. |
66 | 75 | * |
67 | 76 | * .. code-block:: c |
68 | 77 | * |
69 | 78 | * struct some_state { |
70 | 79 | * spinlock_t lock; |
71 | 80 | * long *counter __pt_guarded_by(&lock); |
72 | 81 | * }; |
| 82 | + * |
| 83 | + * struct some_state { |
| 84 | + * spinlock_t lock1, lock2; |
| 85 | + * long *counter __pt_guarded_by(&lock1, &lock2); |
| 86 | + * }; |
73 | 87 | */ |
74 | 88 | # define __pt_guarded_by(...) __attribute__((pt_guarded_by(__VA_ARGS__))) |
75 | 89 |
|
|
0 commit comments