Re: [PATCH 2/3] index-pack: drop type_cas mutex
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Oct 7, 2020, 20:09 UTC
- Message-ID
- <20201007200906.1318031-1-jonathantanmy@google.com>
- In-Reply-To
- <20201007181943.GB1976631@coredump.intra.peff.net>
Show 12 quoted lines
> The type_cas lock lost all of its callers in f08cbf60fe (index-pack: > make quantum of work smaller, 2020-09-08), so we can safely delete it. > The compiler didn't alert us that the variable became unused, because we > still call pthread_mutex_init() and pthread_mutex_destroy() on it. > > It's worth considering also whether that commit was in error to remove > the use of the lock. Why don't we need it now, if we did before, as > described in ab791dd138 (index-pack: fix race condition with duplicate > bases, 2014-08-29)? I think the answer is that we now look at and assign > the child_obj->real_type field in the main thread while holding the > work_lock(). So we don't have to worry about racing with the worker > threads.
Yeah - I probably should have made the change without removing the compare-and-swap, and then removed the compare-and-swap in a subsequent patch. Thanks for catching this.