OSDN Git Service

[Timer] Move DefaultTimerGroup into a ManagedStatic.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 29 May 2017 14:05:29 +0000 (14:05 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 29 May 2017 14:05:29 +0000 (14:05 +0000)
commit6d432cf813c3beeed86e2666f732f5a5baa91ad8
treeba96c168aaafefe39849d969c9887f0db734d663
parent10f535273f8e96eee4da99642145b7f42ef369d9
[Timer] Move DefaultTimerGroup into a ManagedStatic.

This used to be just leaked. r295370 made it use magic statics. This adds
a global destructor, which is something we'd like to avoid. It also creates
a weird situation where the mutex used by TimerGroup is re-created during
global shutdown and leaked.

Using a ManagedStatic here is also subtle as it relies on the mutex
inside of ManagedStatic to be recursive. I've added a test for that
in a previous change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304156 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Timer.cpp