libbacktraceoffline: make it thread-safe.

Make libbacktraceoffline thread-safe by protecting the global variable with
a lock. So it can be used in a multi-thread environment, like by
simpleperf inplace sampling.

Bug: http://b/30974760
Test: no
Change-Id: I4699bf15dfa69ac75faeb4e79a73fb3af0f08dfc
1 file changed