@@ -71,7 +71,7 @@ class demote_promote_writer_readers_lock
71
71
return oldState & preemptedMask;
72
72
};
73
73
74
- perform_under_locked_state (std::move ( success) , preemptionCheck);
74
+ perform_under_locked_state (success, preemptionCheck);
75
75
}
76
76
77
77
/* *
@@ -92,7 +92,7 @@ class demote_promote_writer_readers_lock
92
92
return (oldState & currentReadersMask) && !(oldState & writingMask);
93
93
};
94
94
95
- perform_under_locked_state (std::move ( success), defaultPreemptionCheck , sanityChecks);
95
+ perform_under_locked_state (success, DefaultPreemptionCheck () , sanityChecks);
96
96
}
97
97
98
98
/* *
@@ -133,7 +133,7 @@ class demote_promote_writer_readers_lock
133
133
return preemptedState;
134
134
};
135
135
136
- perform_under_locked_state (std::move ( success) , preemptionCheck, defaultSanityChecks, preempted);
136
+ perform_under_locked_state (success, preemptionCheck, defaultSanityChecks, preempted);
137
137
}
138
138
139
139
/* *
@@ -154,7 +154,7 @@ class demote_promote_writer_readers_lock
154
154
return (oldState & writingMask) && !(oldState & currentReadersMask);
155
155
};
156
156
157
- perform_under_locked_state (std::move ( success), defaultPreemptionCheck , sanityChecks);
157
+ perform_under_locked_state (success, DefaultPreemptionCheck () , sanityChecks);
158
158
}
159
159
160
160
/* *
@@ -206,7 +206,7 @@ class demote_promote_writer_readers_lock
206
206
return preemptedState;
207
207
};
208
208
209
- perform_under_locked_state (std::move ( success) , preemptionCheck, sanityChecks, preempted);
209
+ perform_under_locked_state (success, preemptionCheck, sanityChecks, preempted);
210
210
}
211
211
212
212
/* *
@@ -229,19 +229,26 @@ class demote_promote_writer_readers_lock
229
229
return (oldState & writingMask) && !(oldState & currentReadersMask);
230
230
};
231
231
232
- perform_under_locked_state (std::move ( success), defaultPreemptionCheck , sanityChecks);
232
+ perform_under_locked_state (success, DefaultPreemptionCheck () , sanityChecks);
233
233
}
234
234
235
235
private:
236
236
237
- constexpr static auto defaultPreemptionCheck = [](const state_lock_value_t oldState) -> bool {return false ; };
237
+ struct DefaultPreemptionCheck
238
+ {
239
+ bool operator ()(state_lock_value_t oldState)
240
+ {
241
+ return false ;
242
+ }
243
+ };
244
+
238
245
constexpr static auto defaultPreempted = [](const state_lock_value_t oldState)->state_lock_value_t {return oldState; };
239
246
constexpr static auto defaultSanityChecks = [](const state_lock_value_t oldState)->bool {return true ; };
240
247
241
- template <typename Success, typename PreemptionCheck = decltype (defaultPreemptionCheck) , typename SanityChecks = decltype (defaultSanityChecks), typename Preempted = decltype (defaultPreempted)>
248
+ template <typename Success, typename PreemptionCheck = DefaultPreemptionCheck , typename SanityChecks = decltype (defaultSanityChecks), typename Preempted = decltype (defaultPreempted)>
242
249
inline void perform_under_locked_state (
243
250
Success&& success,
244
- PreemptionCheck& preemptionCheck = defaultPreemptionCheck ,
251
+ PreemptionCheck&& preemptionCheck = DefaultPreemptionCheck() ,
245
252
SanityChecks& sanityChecks = defaultSanityChecks,
246
253
Preempted& preempted = defaultPreempted
247
254
)
0 commit comments