diff options
author | Reid Kleckner <rnk@google.com> | 2017-07-12 18:23:06 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-07-12 18:23:06 +0000 |
commit | 5ae1bfe813126dc68fe1b9f572d0bd59d481feca (patch) | |
tree | e6e6e572adfff0b376cfb8563bd3a0ecb72afa33 /llvm/lib/Support/DynamicLibrary.cpp | |
parent | 52b2dbb6737123c2ed0e33b75233c7d3ee438cb4 (diff) | |
download | llvm-5ae1bfe813126dc68fe1b9f572d0bd59d481feca.zip llvm-5ae1bfe813126dc68fe1b9f572d0bd59d481feca.tar.gz llvm-5ae1bfe813126dc68fe1b9f572d0bd59d481feca.tar.bz2 |
Use std::mutex to avoid memory allocation after OOM
ManagedStatic<sys::Mutex> would lazilly allocate a sys::Mutex to lock
when reporting an OOM, which is a bad idea.
The three STL implementations that I know of use pthread_mutex_lock and
EnterCriticalSection to implement std::mutex. I'm pretty sure that
neither of those allocate heap memory.
It seems that we unconditionally use std::mutex without testing
LLVM_ENABLE_THREADS elsewhere in the codebase, so this should be
portable.
llvm-svn: 307827
Diffstat (limited to 'llvm/lib/Support/DynamicLibrary.cpp')
0 files changed, 0 insertions, 0 deletions