Fix race condition in our log function.
Fix race condition in our log function.

Yes this sucks because it makes logging even slower.

Unfortunately the unlocked_stdio(3) functions are not very well developed (limited and not widely available). So we can't even skip locking in the two printfs.

Not sure what the best solution is.

btrask/stronglink,btrask/stronglink,btrask/stronglink,btrask/stronglink