Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: src/base/platform/platform-posix.cc

Issue 649553002: Sync OS::GetCurrentThreadId with chromium's/blink's implementation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Platform-specific code for POSIX goes here. This is not a platform on its 5 // Platform-specific code for POSIX goes here. This is not a platform on its
6 // own, but contains the parts which are the same across the POSIX platforms 6 // own, but contains the parts which are the same across the POSIX platforms
7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX.
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return NAN; 246 return NAN;
247 } 247 }
248 248
249 249
250 int OS::GetCurrentProcessId() { 250 int OS::GetCurrentProcessId() {
251 return static_cast<int>(getpid()); 251 return static_cast<int>(getpid());
252 } 252 }
253 253
254 254
255 int OS::GetCurrentThreadId() { 255 int OS::GetCurrentThreadId() {
256 #if defined(ANDROID) 256 #if V8_OS_MACOSX
257 return static_cast<int>(pthread_mac_thread_np(pthread_self()));
258 #elif V8_OS_LINUX
257 return static_cast<int>(syscall(__NR_gettid)); 259 return static_cast<int>(syscall(__NR_gettid));
258 #elif defined(SYS_gettid) 260 #elif V8_OS_ANDROID
259 return static_cast<int>(syscall(SYS_gettid)); 261 return static_cast<int>(gettid());
260 #else 262 #else
261 // PNaCL doesn't have a way to get an integral thread ID, but it doesn't 263 return reinterpret_cast<int>(pthread_self());
262 // really matter, because we only need it in PerfJitLogger::LogRecordedBuffer.
263 return 0;
264 #endif 264 #endif
265 } 265 }
266 266
267 267
268 // ---------------------------------------------------------------------------- 268 // ----------------------------------------------------------------------------
269 // POSIX date/time support. 269 // POSIX date/time support.
270 // 270 //
271 271
272 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { 272 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
273 #if V8_OS_NACL 273 #if V8_OS_NACL
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 669
670 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 670 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
671 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); 671 pthread_key_t pthread_key = LocalKeyToPthreadKey(key);
672 int result = pthread_setspecific(pthread_key, value); 672 int result = pthread_setspecific(pthread_key, value);
673 DCHECK_EQ(0, result); 673 DCHECK_EQ(0, result);
674 USE(result); 674 USE(result);
675 } 675 }
676 676
677 677
678 } } // namespace v8::base 678 } } // namespace v8::base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698