projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ManualExecutor: add clear method
[folly.git]
/
folly
/
ThreadCachedInt.h
diff --git
a/folly/ThreadCachedInt.h
b/folly/ThreadCachedInt.h
index 69c03d1f020ce7f5214f3eaf7d77c57c0b302125..fcc4a7ea0e2f18e256f7c79db215d170a5e2a1de 100644
(file)
--- a/
folly/ThreadCachedInt.h
+++ b/
folly/ThreadCachedInt.h
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 201
3
Facebook, Inc.
+ * Copyright 201
6
Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-20,12
+20,14
@@
* @author Spencer Ahrens (sahrens)
*/
* @author Spencer Ahrens (sahrens)
*/
-#ifndef FOLLY_THREADCACHEDINT_H
-#define FOLLY_THREADCACHEDINT_H
+#pragma once
#include <atomic>
#include <atomic>
-#include "folly/Likely.h"
-#include "folly/ThreadLocal.h"
+
+#include <boost/noncopyable.hpp>
+
+#include <folly/Likely.h>
+#include <folly/ThreadLocal.h>
namespace folly {
namespace folly {
@@
-45,7
+47,7
@@
class ThreadCachedInt : boost::noncopyable {
void increment(IntT inc) {
auto cache = cache_.get();
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);
}
cache = new IntCache(*this);
cache_.reset(cache);
}
@@
-119,7
+121,7
@@
class ThreadCachedInt : boost::noncopyable {
// need to make sure we signal that this parent is dead.
~ThreadCachedInt() {
for (auto& cache : cache_.accessAllThreads()) {
// need to make sure we signal that this parent is dead.
~ThreadCachedInt() {
for (auto& cache : cache_.accessAllThreads()) {
- cache.parent_ =
NULL
;
+ cache.parent_ =
nullptr
;
}
}
}
}
@@
-172,5
+174,3
@@
class ThreadCachedInt : boost::noncopyable {
};
}
};
}
-
-#endif