Do not assert when the app state changes from 'unavailable' to 'available'
Use the thread-safe version of the profiling code automatically

We can just compare the current thread with the 'main' thread and append the
thread ID automatically in the case of a new thread. Relying on API users to
know what thread they are coming from is just not required and is easy to get
wrong.