Replaces #13099.
The goal here is the same as the previous PR, but this approach only includes threadnames in logs when we can make use of thread_local
. We specifically disable HAVE_THREAD_LOCAL
for platforms where its presence or implementation is questionable (Darwin, mingw32).
Instead of using a mutex-protected map to generate numeric suffixes (e.g. httpworker.2
) we explicitly pass in suffixes during thread creation.
Under this changeset, logs look like this:
02018-06-13T21:43:28Z [bitcoin-qt-init] init message: Starting network threads...
12018-06-13T21:43:28Z [net] net thread start
22018-06-13T21:43:28Z [bitcoin-qt-init] init message: Done loading
32018-06-13T21:43:28Z [opencon] opencon thread start
42018-06-13T21:43:28Z [msghand] msghand thread start
52018-06-13T21:43:28Z [dnsseed] dnsseed thread start
62018-06-13T21:43:28Z [dnsseed] Loading addresses from DNS seeds (could take a while)
72018-06-13T21:43:28Z [dnsseed] 0 addresses found from DNS seeds
82018-06-13T21:43:28Z [dnsseed] dnsseed thread exit
92018-06-13T21:43:28Z [addcon] addcon thread start
102018-06-13T21:43:28Z [bitcoin-qt] GUI: Platform customization: "other"
112018-06-13T21:43:28Z [bitcoin-qt] GUI: PaymentServer::LoadRootCAs: Loaded 146 root certificates
122018-06-13T21:43:28Z [loadblk] Loaded 1 blocks from external file in 147ms
132018-06-13T21:43:28Z [loadblk] Reindexing finished
142018-06-13T21:43:28Z [loadblk] Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there