• Clemens Hammacher's avatar
    [tracing] Fix data race · 0ba3de60
    Clemens Hammacher authored
    There is a data race if several background threads check for a tracing
    flag concurrently. Both will call {GetCategoryGroupEnabledInternal}.
    The first one not find the category in the {g_category_group_enabled}
    array, and hence will add it and call {UpdateCategoryGroupEnabledFlag}
    to initialize the flag. The second thread then finds the entry in the
    array and reads it without any synchronization, which is a data race.
    
    Since we do not really care about this race, we just use a
    {Relaxed_Load} to read the field. TSan is fine with that.
    
    R=yangguo@chromium.org
    CC=ofrobots@google.com
    
    Bug: v8:8221
    Change-Id: Ie09141e3d845956d3c487a463f00b7d6cd413513
    Reviewed-on: https://chromium-review.googlesource.com/1245424Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#56256}
    0ba3de60
trace-event.h 32.9 KB