xref: /aosp_15_r20/bionic/libc/async_safe/README.md (revision 8d67ca893c1523eb926b9080dbe4e2ffd2a27ba1)
1*8d67ca89SAndroid Build Coastguard Worker# async_safe logging
2*8d67ca89SAndroid Build Coastguard Worker
3*8d67ca89SAndroid Build Coastguard WorkerThis library provides an async_safe implementation for formatting and writing log messages to logd.
4*8d67ca89SAndroid Build Coastguard Worker
5*8d67ca89SAndroid Build Coastguard WorkerNote that the liblog implementation connects a single socket to logd and uses a RWLock to manage
6*8d67ca89SAndroid Build Coastguard Workerit among threads, whereas these functions connect to liblog for each log message.  While it's
7*8d67ca89SAndroid Build Coastguard Workerbeneficial to have this lock-free and therefore async_safe mechanism to write to logd, connecting
8*8d67ca89SAndroid Build Coastguard Workera socket for each message does not scale well under load.  It was also determined to be too
9*8d67ca89SAndroid Build Coastguard Workercostly to connect a socket for each thread as some processes, such as system_server, have over 100
10*8d67ca89SAndroid Build Coastguard Workerthreads.  Therefore, we maintain these two separate mechanisms.
11