os/log.c thread safety

Jeremy Huddleston Sequoia jeremyhu at apple.com
Mon Sep 19 08:39:19 UTC 2016


> On Sep 18, 2016, at 21:58, Keith Packard <keithp at keithp.com> wrote:
> 
> Jeremy Huddleston Sequoia <jeremyhu at apple.com> writes:
> 
>> [ Unknown signature status ]
>> I noticed a data race in XQuartz.  We call ErrorF in a couple places off of the main server thread.  I could fix it by simply moving this logging onto the server thread (or not doing it with os/log), but with the split of InputThread off of MainThread, I'm wondering if it would be better to instead make ErrorF thread safe.
>> 
>> Thoughts?
> 
> If we use ErrorF in server abort paths, then any thread safety might
> block the server shutdown, which would be bad...

Yeah, good point.

So then what should be the logging story for things on the input thread?  XQuartz's AppKit thread is basically in the same boat, so I'd prefer to not do two different things.  Should we just use TLS and expect collisions to resolve unfortunately?

FWIW, the issues surround these globals:
    bufferUnused
    bufferPos
    LogSWrite.newline

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4465 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160919/0f683423/attachment.bin>


More information about the xorg-devel mailing list