ostream internals are now protected by a lock, which ensures the
internal state stays consistant, however, this won't prevent
multiple threads to have their output ominterfering with each other,
which is no different from the stl behavior.
This fixes#4992
__ANDROID__ is always set by the toolchain and less likely to cause
conflicts than ANDROID. This change also removes the -DANDROID flag
we set ourselves in our toolchain CMake files since we don't need
it anymore.
This reverts commit cc6201b0db.
On Android the loggers are not always initialized when several .so are
used, leading to crashes. It's not completely clear what is exactly
happening.
- libutil's slog, cout, cerr, cwarn and cinfo were not thread safe
at all.
- they are now thread_local
- for that reason the log buffer (which now exists per thread) is not
allocated until it's needed and is aggressively shrunk.
- removed our thread_local emulation which was incomplete.
- don't expose LogStream publicly.