5 #ifndef V8_THREAD_ID_H_ 6 #define V8_THREAD_ID_H_ 8 #include "src/base/atomicops.h" 17 ThreadId() { base::Relaxed_Store(&id_, kInvalidId); }
20 base::Relaxed_Store(&id_, base::Relaxed_Load(&other.id_));
24 bool operator==(
const ThreadId& other)
const {
return Equals(other); }
36 V8_INLINE
bool Equals(
const ThreadId& other)
const {
37 return base::Relaxed_Load(&id_) == base::Relaxed_Load(&other.id_);
41 V8_INLINE
bool IsValid()
const {
42 return base::Relaxed_Load(&id_) != kInvalidId;
47 int ToInteger()
const {
return static_cast<int>(base::Relaxed_Load(&id_)); }
54 static const int kInvalidId = -1;
56 explicit ThreadId(
int id) { base::Relaxed_Store(&id_,
id); }
58 static int AllocateThreadId() {
59 int new_id = base::Relaxed_AtomicIncrement(&highest_thread_id_, 1);
63 static int GetCurrentThreadId();
67 static base::Atomic32 highest_thread_id_;
73 #endif // V8_THREAD_ID_H_