Test to try to track down the alignment problem on Mac 10.9.
There's no code change here, I'm rearranging member variables of the trace class and adding a sizeof check to the CriticalSection class + alignment attribute for the mutex, on Mac only. TBR=pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/38339004 Cr-Commit-Position: refs/heads/master@{#8540} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8540 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -22,6 +22,22 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(WEBRTC_MAC)
|
||||||
|
// TODO(tommi): This is a temporary test to see if critical section objects are
|
||||||
|
// somehow causing pointer co-member variables that follow a critical section
|
||||||
|
// variable, are somehow throwing off the alignment and causing crash on
|
||||||
|
// the Mac 10.9 debug bot:
|
||||||
|
// http://build.chromium.org/p/chromium.mac/builders/Mac10.9%20Tests%20(dbg)
|
||||||
|
#define _MUTEX_ALIGNMENT __attribute__((__aligned__(8)))
|
||||||
|
#define _STATIC_ASSERT_CRITICAL_SECTION_SIZE() \
|
||||||
|
static_assert(sizeof(CriticalSection) % 8 == 0, \
|
||||||
|
"Bad size of CriticalSection")
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define _MUTEX_ALIGNMENT
|
||||||
|
#define _STATIC_ASSERT_CRITICAL_SECTION_SIZE()
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define CS_TRACK_OWNER 1
|
#define CS_TRACK_OWNER 1
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
@ -63,6 +79,7 @@ class LOCKABLE CriticalSection {
|
|||||||
class LOCKABLE CriticalSection {
|
class LOCKABLE CriticalSection {
|
||||||
public:
|
public:
|
||||||
CriticalSection() {
|
CriticalSection() {
|
||||||
|
_STATIC_ASSERT_CRITICAL_SECTION_SIZE();
|
||||||
pthread_mutexattr_t mutex_attribute;
|
pthread_mutexattr_t mutex_attribute;
|
||||||
pthread_mutexattr_init(&mutex_attribute);
|
pthread_mutexattr_init(&mutex_attribute);
|
||||||
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
|
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
|
||||||
@ -99,7 +116,7 @@ class LOCKABLE CriticalSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pthread_mutex_t mutex_;
|
_MUTEX_ALIGNMENT pthread_mutex_t mutex_;
|
||||||
TRACK_OWNER(pthread_t thread_);
|
TRACK_OWNER(pthread_t thread_);
|
||||||
};
|
};
|
||||||
#endif // WEBRTC_POSIX
|
#endif // WEBRTC_POSIX
|
||||||
|
@ -93,12 +93,12 @@ class TraceImpl : public Trace {
|
|||||||
void WriteToFile(const char* msg, uint16_t length)
|
void WriteToFile(const char* msg, uint16_t length)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(crit_);
|
EXCLUSIVE_LOCKS_REQUIRED(crit_);
|
||||||
|
|
||||||
rtc::CriticalSection crit_;
|
|
||||||
TraceCallback* callback_ GUARDED_BY(crit_);
|
TraceCallback* callback_ GUARDED_BY(crit_);
|
||||||
uint32_t row_count_text_ GUARDED_BY(crit_);
|
uint32_t row_count_text_ GUARDED_BY(crit_);
|
||||||
uint32_t file_count_text_ GUARDED_BY(crit_);
|
uint32_t file_count_text_ GUARDED_BY(crit_);
|
||||||
|
|
||||||
const rtc::scoped_ptr<FileWrapper> trace_file_ GUARDED_BY(crit_);
|
const rtc::scoped_ptr<FileWrapper> trace_file_ GUARDED_BY(crit_);
|
||||||
|
rtc::CriticalSection crit_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
Reference in New Issue
Block a user