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

Unified Diff: src/trusted/service_runtime/osx/nacl_thread_nice.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 | « src/shared/platform/osx/nacl_clock.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/osx/nacl_thread_nice.c
===================================================================
--- src/trusted/service_runtime/osx/nacl_thread_nice.c (revision 13163)
+++ src/trusted/service_runtime/osx/nacl_thread_nice.c (working copy)
@@ -11,6 +11,7 @@
#include <mach/mach_time.h>
#include <mach/thread_policy.h>
#include <mach/thread_act.h>
+#include <pthread.h>
#include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/trusted/service_runtime/include/sys/nacl_nice.h"
@@ -48,8 +49,14 @@
int nacl_thread_nice(int nacl_nice) {
kern_return_t kr;
- thread_act_t mthread = 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.
+ */
+ thread_act_t mthread = pthread_mach_thread_np(pthread_self());
+
switch (nacl_nice) {
case NICE_REALTIME: {
struct thread_time_constraint_policy tcpolicy;
« no previous file with comments | « src/shared/platform/osx/nacl_clock.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698