diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2018-01-21 20:55:46 +0000 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2018-01-21 21:09:52 +0000 |
commit | 8b66a8c6ec6dedd2a80d1c9d35eafebf49f5cead (patch) | |
tree | a9504277bdde528c3157fd614a814a9d3916de68 /src/global.c | |
parent | 820370fe846167faaeabb2238cae900489af6bb8 (diff) | |
download | libgit2-8b66a8c6ec6dedd2a80d1c9d35eafebf49f5cead.tar.gz |
atexit: create skeletoncmn/atexit-skeleton
This provides a skeleton for registering rollback functions in case the caller
wants to centralise their error handling in an `atexit(3)`-like manner.
Subsystems within libgit2 will register themselves when they e.g. create
lockfiles. If the caller detects an error (potentially unrelated to the libgit2
operation) and wants to back out, they could call `git_atexit()` in order to
remove lockfiles which the library is holding.
Diffstat (limited to 'src/global.c')
-rw-r--r-- | src/global.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/global.c b/src/global.c index 89183080b..853f90270 100644 --- a/src/global.c +++ b/src/global.c @@ -15,6 +15,7 @@ #include "thread-utils.h" #include "git2/global.h" #include "transports/ssh.h" +#include "atexit.h" #if defined(GIT_MSVC_CRTDBG) #include "win32/w32_stack.h" @@ -63,7 +64,8 @@ static int init_common(void) (ret = git_filter_global_init()) == 0 && (ret = git_merge_driver_global_init()) == 0 && (ret = git_transport_ssh_global_init()) == 0 && - (ret = git_openssl_stream_global_init()) == 0) + (ret = git_openssl_stream_global_init()) == 0 && + (ret = git_atexit_global_init() == 0)) ret = git_mwindow_global_init(); GIT_MEMORY_BARRIER; |