ThreadPlatformData.h (1049B)
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_posix_PlatformData_h 8 #define threading_posix_PlatformData_h 9 10 #include <pthread.h> 11 #include <string.h> 12 13 #if defined(__APPLE__) && defined(__MACH__) 14 # include <dlfcn.h> 15 #endif 16 17 #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) 18 # include <pthread_np.h> 19 #endif 20 21 #if defined(__linux__) 22 # include <sys/prctl.h> 23 #endif 24 25 #include "threading/Thread.h" 26 27 namespace js { 28 29 class ThreadId::PlatformData { 30 friend class Thread; 31 friend class ThreadId; 32 pthread_t ptThread; 33 34 // pthread_t does not have a default initializer, so we have to carry a bool 35 // to tell whether it is safe to compare or not. 36 bool hasThread; 37 }; 38 39 } // namespace js 40 41 #endif // threading_posix_PlatformData_h