1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef threading_ThreadId_h
8 #define threading_ThreadId_h
9 
10 namespace js {
11 
12 class ThreadId {
13   class PlatformData;
14   void* platformData_[2];
15 
16  public:
17   ThreadId();
18 
19   ThreadId(const ThreadId&) = default;
20   ThreadId(ThreadId&&) = default;
21   ThreadId& operator=(const ThreadId&) = default;
22   ThreadId& operator=(ThreadId&&) = default;
23 
24   bool operator==(const ThreadId& aOther) const;
25   bool operator!=(const ThreadId& aOther) const { return !operator==(aOther); }
26 
27   MOZ_IMPLICIT operator bool() const;
28 
29   inline PlatformData* platformData();
30   inline const PlatformData* platformData() const;
31 
32   // Return the thread id of the calling thread.
33   static ThreadId ThisThreadId();
34 };
35 
36 }  // namespace js
37 
38 #endif  // threading_ThreadId_h
39