login
Header Space

 
 

Re: [PATCH] lockfile.c: schedule remove_lock_file only once.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Sven Verdoolaege <skimo@...>
Cc: <git@...>
Date: Friday, July 13, 2007 - 2:23 pm

Sven Verdoolaege <skimo@kotnet.org> writes:


Yeah.  I wonder what we were smoking.  415e96c8 which introduces
the atexit to index.c does:

    int hold_index_file_for_update(struct cache_file *cf, const char *path)
    {
           sprintf(cf->lockfile, "%s.lock", path);
           cf->next = cache_file_list;
           cache_file_list = cf;
           if (!cf->next) {
                   signal(SIGINT, remove_lock_file_on_signal);
                   atexit(remove_lock_file);
           }
           return open(cf->lockfile, O_RDWR | O_CREAT | O_EXCL, 0600);
    }

whose intent is exactly "do this once, only for the first one".

The reason we do not use lk->next but instead check lk->on_list,
and the reason why we do not remove the lock from the list, are
described in 1084b845.

But your "fire atexit() once" fix is needed.  Thanks.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] lockfile.c: schedule remove_lock_file only once., Sven Verdoolaege, (Fri Jul 13, 10:14 am)
Re: [PATCH] lockfile.c: schedule remove_lock_file only once., Junio C Hamano, (Fri Jul 13, 2:23 pm)
Re: [PATCH] lockfile.c: schedule remove_lock_file only once., Sven Verdoolaege, (Sun Jul 15, 4:35 am)
speck-geostationary