/*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @author Spencer Ahrens (sahrens)
*/
-#ifndef FOLLY_THREADCACHEDINT_H
-#define FOLLY_THREADCACHEDINT_H
+#pragma once
#include <atomic>
#include <boost/noncopyable.hpp>
-#include "folly/Likely.h"
-#include "folly/ThreadLocal.h"
+#include <folly/Likely.h>
+#include <folly/ThreadLocal.h>
namespace folly {
void increment(IntT inc) {
auto cache = cache_.get();
- if (UNLIKELY(cache == NULL || cache->parent_ == NULL)) {
+ if (UNLIKELY(cache == nullptr || cache->parent_ == nullptr)) {
cache = new IntCache(*this);
cache_.reset(cache);
}
// need to make sure we signal that this parent is dead.
~ThreadCachedInt() {
for (auto& cache : cache_.accessAllThreads()) {
- cache.parent_ = NULL;
+ cache.parent_ = nullptr;
}
}
};
}
-
-#endif