diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-10-23 17:34:41 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-11-08 23:46:39 +0100 |
commit | 799e22ea0c3f20f1900011573a10053dc3ea9138 (patch) | |
tree | 43af7e21e2872ee3b83a1478ceb75b068b100a1c /src | |
parent | 4865cc3f0631a8a4e0e1de897865df0e552c70cb (diff) | |
download | libgit2-799e22ea0c3f20f1900011573a10053dc3ea9138.tar.gz |
Rename git_threads_ to git_libgit2_
This describes their purpose better, as we now initialize ssl and some
other global stuff in there. Calling the init function is not something
which has been optional for a while now.
Diffstat (limited to 'src')
-rw-r--r-- | src/global.c | 21 | ||||
-rw-r--r-- | src/hash/hash_win32.c | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/global.c b/src/global.c index 3c91860cd..da903cb94 100644 --- a/src/global.c +++ b/src/global.c @@ -9,6 +9,7 @@ #include "hash.h" #include "sysdir.h" #include "git2/threads.h" +#include "git2/global.h" #include "thread-utils.h" @@ -133,7 +134,7 @@ int git_openssl_set_locking(void) * Handle the global state with TLS * * If libgit2 is built with GIT_THREADS enabled, - * the `git_threads_init()` function must be called + * the `git_libgit2_init()` function must be called * before calling any other function of the library. * * This function allocates a TLS index (using pthreads @@ -146,7 +147,7 @@ int git_openssl_set_locking(void) * allocated on each thread. * * Before shutting down the library, the - * `git_threads_shutdown` method must be called to free + * `git_libgit2_shutdown` method must be called to free * the previously reserved TLS index. * * If libgit2 is built without threading support, the @@ -156,9 +157,9 @@ int git_openssl_set_locking(void) */ /* - * `git_threads_init()` allows subsystems to perform global setup, + * `git_libgit2_init()` allows subsystems to perform global setup, * which may take place in the global scope. An explicit memory - * fence exists at the exit of `git_threads_init()`. Without this, + * fence exists at the exit of `git_libgit2_init()`. Without this, * CPU cores are free to reorder cache invalidation of `_tls_init` * before cache invalidation of the subsystems' newly written global * state. @@ -185,7 +186,7 @@ static int synchronized_threads_init(void) return error; } -int git_threads_init(void) +int git_libgit2_init(void) { int error = 0; @@ -210,7 +211,7 @@ static void synchronized_threads_shutdown(void) git_mutex_free(&git__mwindow_mutex); } -void git_threads_shutdown(void) +void git_libgit2_shutdown(void) { /* Enter the lock */ while (InterlockedCompareExchange(&_mutex, 1, 0)) { Sleep(0); } @@ -272,14 +273,14 @@ static void init_once(void) GIT_MEMORY_BARRIER; } -int git_threads_init(void) +int git_libgit2_init(void) { pthread_once(&_once_init, init_once); git_atomic_inc(&git__n_inits); return init_error; } -void git_threads_shutdown(void) +void git_libgit2_shutdown(void) { void *ptr = NULL; pthread_once_t new_once = PTHREAD_ONCE_INIT; @@ -320,7 +321,7 @@ git_global_st *git__global_state(void) static git_global_st __state; -int git_threads_init(void) +int git_libgit2_init(void) { static int ssl_inited = 0; @@ -333,7 +334,7 @@ int git_threads_init(void) return 0; } -void git_threads_shutdown(void) +void git_libgit2_shutdown(void) { /* Shut down any subsystems that have global state */ if (0 == git_atomic_dec(&git__n_inits)) diff --git a/src/hash/hash_win32.c b/src/hash/hash_win32.c index bb2231364..6bae53e55 100644 --- a/src/hash/hash_win32.c +++ b/src/hash/hash_win32.c @@ -236,7 +236,7 @@ int git_hash_ctx_init(git_hash_ctx *ctx) /* * When compiled with GIT_THREADS, the global hash_prov data is - * initialized with git_threads_init. Otherwise, it must be initialized + * initialized with git_libgit2_init. Otherwise, it must be initialized * at first use. */ if (hash_prov.type == INVALID && (error = git_hash_global_init()) < 0) |