Summary:
- Manually swap bucket_ entries in HHWheelTimer to work around a bug in
libc++
Test Plan:
- fbconfig -r folly/io/async && fbmake runtests --extended-tests
- Sync to OS X and build there
Reviewed By: davejwatson@fb.com
Subscribers: trunkagent, doug, seanc, folly-diffs@
FB internal diff:
D1766601
Signature: t1:
1766601:
1420566916:
24a2911e997ee04f0934884bdf7b82345cb2b752
size_t HHWheelTimer::cancelAll() {
decltype(buckets_) buckets;
+
+// Work around std::swap() bug in libc++
+//
+// http://llvm.org/bugs/show_bug.cgi?id=22106
+#if FOLLY_USE_LIBCPP
+ for (size_t i = 0; i < WHEEL_BUCKETS; ++i) {
+ for (size_t ii = 0; i < WHEEL_SIZE; ++ii) {
+ std::swap(buckets_[i][ii], buckets[i][ii]);
+ }
+ }
+#else
std::swap(buckets, buckets_);
+#endif
+
size_t count = 0;
for (auto& tick : buckets) {