Stefan Beller <sbeller@xxxxxxxxxx> writes: > Instead of having a global attr stack, attach the stack to each check. > This allows to use the attr in a multithreaded way. > > > > Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> > --- > attr.c | 101 +++++++++++++++++++++++++++++++++++++++----------------------- > attr.h | 4 ++- > hashmap.h | 2 ++ > 3 files changed, 69 insertions(+), 38 deletions(-) This looks surprisingly simple ;-) I like it. I briefly wondered if the addition of lock/unlock surrounding git_check_attrs() function belongs to [27/36], but that step is not about making things thread-safe and is primarily to prepare existing users to use an updated API that can be made thread-safe in later steps. This [28/36] is the step to have these---so the addition is not out-of-space at all. Nicely done. As this starts to pass a fully populated check object down to the callchain that begins at bootstrap_attr_stack(), it makes it easier to add the per-check optimization to read and keep only the relevant entries from the attribute files later, by passing check also to the read_attr_from_file() function. The "set-direction" thing is not yet thread-safe, but I am not sure what the best way to go there offhand. It somehow feels unnecessary to allow some thread to be going in the GIT_ATTR_CHECKIN direction while others to be going in the GIT_ATTR_CHECKOUT direction, so we probably can leave it at a lower priority for now.