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

Unified Diff: src/shared/platform/osx/nacl_clock.c

Issue 276043002: Use pthread_mach_thread_np(pthread_self()) instead of mach_thread_self() (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/trusted/service_runtime/osx/nacl_thread_nice.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/platform/osx/nacl_clock.c
===================================================================
--- src/shared/platform/osx/nacl_clock.c (revision 13163)
+++ src/shared/platform/osx/nacl_clock.c (working copy)
@@ -22,6 +22,7 @@
#include <mach/task.h>
#include <mach/task_info.h>
#include <mach/thread_info.h>
+#include <pthread.h>
static int g_NaClClock_is_initialized = 0;
static mach_timebase_info_data_t g_NaCl_time_base_info;
@@ -131,7 +132,12 @@
case NACL_CLOCK_THREAD_CPUTIME_ID:
count = THREAD_BASIC_INFO_COUNT;
- if (KERN_SUCCESS == thread_info(mach_thread_self(),
+ /*
+ * Don't use mach_thread_self() because it requires a separate
+ * mach_port_deallocate() system call to release it. Instead, rely on
+ * pthread's cached copy of the port.
+ */
+ if (KERN_SUCCESS == thread_info(pthread_mach_thread_np(pthread_self()),
THREAD_BASIC_INFO,
(thread_info_t) basic_info,
&count)) {
« no previous file with comments | « no previous file | src/trusted/service_runtime/osx/nacl_thread_nice.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698