OLD | NEW |
| (Empty) |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_INSPECTOR_ATOMICS_H_ | |
6 #define V8_INSPECTOR_ATOMICS_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #if defined(_MSC_VER) | |
11 #include <windows.h> | |
12 #endif | |
13 | |
14 namespace v8_inspector { | |
15 | |
16 #if defined(_MSC_VER) | |
17 | |
18 inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r
einterpret_cast<long volatile*>(addend)); } | |
19 | |
20 #else | |
21 | |
22 inline int atomicAdd(int volatile* addend, int increment) { return __sync_add_an
d_fetch(addend, increment); } | |
23 inline int atomicIncrement(int volatile* addend) { return atomicAdd(addend, 1);
} | |
24 | |
25 #endif | |
26 | |
27 } // namespace v8_inspector | |
28 | |
29 #endif // V8_INSPECTOR_ATOMICS_H_ | |
OLD | NEW |