[TSan] re-apply r177249 lost in edits