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:
parent
73acc15c69
commit
d31250518a
@ -22,6 +22,22 @@
|
||||
#include <pthread.h>
|
||||
#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
|
||||
#define CS_TRACK_OWNER 1
|
||||
#endif // _DEBUG
|
||||
@ -63,6 +79,7 @@ class LOCKABLE CriticalSection {
|
||||
class LOCKABLE CriticalSection {
|
||||
public:
|
||||
CriticalSection() {
|
||||
_STATIC_ASSERT_CRITICAL_SECTION_SIZE();
|
||||
pthread_mutexattr_t mutex_attribute;
|
||||
pthread_mutexattr_init(&mutex_attribute);
|
||||
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
|
||||
@ -99,7 +116,7 @@ class LOCKABLE CriticalSection {
|
||||
}
|
||||
|
||||
private:
|
||||
pthread_mutex_t mutex_;
|
||||
_MUTEX_ALIGNMENT pthread_mutex_t mutex_;
|
||||
TRACK_OWNER(pthread_t thread_);
|
||||
};
|
||||
#endif // WEBRTC_POSIX
|
||||
|
@ -93,12 +93,12 @@ class TraceImpl : public Trace {
|
||||
void WriteToFile(const char* msg, uint16_t length)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(crit_);
|
||||
|
||||
rtc::CriticalSection crit_;
|
||||
TraceCallback* callback_ GUARDED_BY(crit_);
|
||||
uint32_t row_count_text_ GUARDED_BY(crit_);
|
||||
uint32_t file_count_text_ GUARDED_BY(crit_);
|
||||
|
||||
const rtc::scoped_ptr<FileWrapper> trace_file_ GUARDED_BY(crit_);
|
||||
rtc::CriticalSection crit_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
Loading…
Reference in New Issue
Block a user