Re: [PATCH v2 22/27] attr: eliminate global check_all_attr array
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 23, 2017, 21:11 UTC
- Message-ID
- <xmqq7f5lqy5n.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170123203525.185058-23-bmwill@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 8 quoted lines
> Currently there is a reliance on 'check_all_attr' which is a global > array of 'attr_check_item' items which is used to store the value of > each attribute during the collection process. > > This patch eliminates this global and instead creates an array per > 'attr_check' instance which is then used in the attribute collection > process. This brings the attribute system one step closer to being > thread-safe.
Hmph, how close is "closer"?
My understanding of this is that a codepath that has a single "attr_check" can be executing simultaneously by multiple threads, and "attr_check" is meant to contain read-only stuff sharable by them. Unless this check_all_attr is tied to the attr_result (which in turn is tied to each invocation and typically is on stack), the resulting code would not be safe, right?