diff options
author | Brian Carlstrom <bdc@google.com> | 2015-03-03 21:21:29 -0800 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2015-03-03 21:21:29 -0800 |
commit | c57ad2006ff00766940e7b9437f48f77ca8517e4 (patch) | |
tree | e806e6cdfb8b42ac17e17f7b29be92111538b88e /runtime/monitor.h | |
parent | ff3ef43f3d0f0986fe23286af028b352277b6e1e (diff) | |
download | art-c57ad2006ff00766940e7b9437f48f77ca8517e4.zip art-c57ad2006ff00766940e7b9437f48f77ca8517e4.tar.gz art-c57ad2006ff00766940e7b9437f48f77ca8517e4.tar.bz2 |
Switch from memalign to posix_memalign for Mac build
Change-Id: Id320015ea3999605954f53b5e266f53e968c7065
Diffstat (limited to 'runtime/monitor.h')
-rw-r--r-- | runtime/monitor.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/monitor.h b/runtime/monitor.h index 2e065ae..95e4460 100644 --- a/runtime/monitor.h +++ b/runtime/monitor.h @@ -19,12 +19,10 @@ #include <pthread.h> #include <stdint.h> +#include <stdlib.h> #include <iosfwd> #include <list> -#ifndef __LP64__ -#include <malloc.h> // For memalign. -#endif #include <vector> #include "atomic.h" @@ -138,7 +136,10 @@ class Monitor { #ifndef __LP64__ void* operator new(size_t size) { // Align Monitor* as per the monitor ID field size in the lock word. - return memalign(LockWord::kMonitorIdAlignment, size); + void* result; + int error = posix_memalign(&result, LockWord::kMonitorIdAlignment, size); + CHECK_EQ(error, 0) << strerror(error); + return result; } #endif @@ -173,7 +174,8 @@ class Monitor { const char* owner_filename, uint32_t owner_line_number) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static void FailedUnlock(mirror::Object* obj, Thread* expected_owner, Thread* found_owner, Monitor* mon) + static void FailedUnlock(mirror::Object* obj, Thread* expected_owner, Thread* found_owner, + Monitor* mon) LOCKS_EXCLUDED(Locks::thread_list_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |