From 6eb5288264d68276085855bd041fa74fbca6827c Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Fri, 19 Jul 2013 00:31:07 -0700 Subject: Conditionally define non-Android pthread structures Change-Id: I2258b521db20dcc6940cb5540ca24ea5bbaf006f --- runtime/base/mutex.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'runtime/base') diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc index cb66240..3265a13 100644 --- a/runtime/base/mutex.cc +++ b/runtime/base/mutex.cc @@ -30,9 +30,11 @@ namespace art { +#if defined(__APPLE__) + // This works on Mac OS 10.6 but hasn't been tested on older releases. struct __attribute__((__may_alias__)) darwin_pthread_mutex_t { - long padding0; // NOLINT(runtime/int) + long padding0; // NOLINT(runtime/int) exact match to darwin type int padding1; uint32_t padding2; int16_t padding3; @@ -43,7 +45,7 @@ struct __attribute__((__may_alias__)) darwin_pthread_mutex_t { }; struct __attribute__((__may_alias__)) darwin_pthread_rwlock_t { - long padding0; // NOLINT(runtime/int) + long padding0; // NOLINT(runtime/int) exact match to darwin type pthread_mutex_t padding1; int padding2; pthread_cond_t padding3; @@ -54,6 +56,10 @@ struct __attribute__((__may_alias__)) darwin_pthread_rwlock_t { // ...other stuff we don't care about. }; +#endif // __APPLE__ + +#if defined(__GLIBC__) + struct __attribute__((__may_alias__)) glibc_pthread_mutex_t { int32_t padding0[2]; int owner; @@ -70,6 +76,8 @@ struct __attribute__((__may_alias__)) glibc_pthread_rwlock_t { // ...other stuff we don't care about. }; +#endif // __GLIBC__ + #if ART_USE_FUTEXES static bool ComputeRelativeTimeSpec(timespec* result_ts, const timespec& lhs, const timespec& rhs) { const int32_t one_sec = 1000 * 1000 * 1000; // one second in nanoseconds. -- cgit v1.1