Skip to content

Commit 3095d19

Browse files
committed
Assert holders and locks are no larger than pointers
1 parent 6da1e96 commit 3095d19

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

provides/include/mcs_v1/synopsis.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ struct holder : Private::holder_t {
2020
holder &operator=(const holder &) = delete;
2121
};
2222

23+
// Holders are no larger than pointers.
24+
static_assert(sizeof(holder) <= sizeof(void *));
25+
2326
/// Type of lock objects.
2427
struct lock : Private::lock_t {
2528
/// Constructs a lock by zero initializing it.
@@ -50,4 +53,7 @@ struct lock : Private::lock_t {
5053
holding(Action &&action, unsigned max_spin_count = default_max_spin_count);
5154
};
5255

56+
// Locks are no larger than pointers.
57+
static_assert(sizeof(lock) <= sizeof(void *));
58+
5359
} // namespace mcs_v1

0 commit comments

Comments
 (0)