Summary: In a thread safety report we used the access path from the final sink. This diffs change the report to include the expanded access path from the initial sink. Reviewed By: sblackshear Differential Revision: D6297848 fbshipit-source-id: 2386063master
parent
b9a56a6c52
commit
e07a20ea6d
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
namespace reporting {
|
||||||
|
|
||||||
|
struct X {
|
||||||
|
int w;
|
||||||
|
X* x1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Basic {
|
||||||
|
public:
|
||||||
|
Basic() {}
|
||||||
|
|
||||||
|
void test(X& xparam) { xparam.x1->w++; }
|
||||||
|
|
||||||
|
void call1() {
|
||||||
|
test(x); // race
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_lock() {
|
||||||
|
mutex_.lock();
|
||||||
|
call1();
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_unlock() { call1(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
X x;
|
||||||
|
std::mutex mutex_;
|
||||||
|
};
|
||||||
|
} // namespace reporting
|
Loading…
Reference in new issue