Beispiel #1
0
int git_libgit2_shutdown(void)
{
	void *ptr = NULL;
	pthread_once_t new_once = PTHREAD_ONCE_INIT;
	int error, ret;

	if ((error = pthread_mutex_lock(&_init_mutex)) != 0)
		return error;

	if ((ret = git_atomic_dec(&git__n_inits)) != 0)
		goto out;

	/* Shut down any subsystems that have global state */
	shutdown_common();

	ptr = pthread_getspecific(_tls_key);
	pthread_setspecific(_tls_key, NULL);

	git__global_state_cleanup(ptr);
	git__free(ptr);

	pthread_key_delete(_tls_key);
	git_mutex_free(&git__mwindow_mutex);
	_once_init = new_once;

out:
	if ((error = pthread_mutex_unlock(&_init_mutex)) != 0)
		return error;

	return ret;
}
Beispiel #2
0
int git_libgit2_shutdown(void)
{
	void *ptr = NULL;
	pthread_once_t new_once = PTHREAD_ONCE_INIT;
	int ret;

	if ((ret = git_atomic_dec(&git__n_inits)) != 0)
		return ret;

	/* Shut down any subsystems that have global state */
	git__shutdown();
	uninit_ssl();

	ptr = pthread_getspecific(_tls_key);
	pthread_setspecific(_tls_key, NULL);

	git__global_state_cleanup(ptr);
	git__free(ptr);

	pthread_key_delete(_tls_key);
	git_mutex_free(&git__mwindow_mutex);
	_once_init = new_once;

	return 0;
}
Beispiel #3
0
/**
 * Free the TLS data associated with this thread.
 * This should only be used by the thread as it
 * is exiting.
 */
void git__free_tls_data(void)
{
	void *ptr = TlsGetValue(_tls_index);
	if (!ptr)
		return;

	git__global_state_cleanup(ptr);
	git__free(ptr);
	TlsSetValue(_tls_index, NULL);
}
Beispiel #4
0
int git_libgit2_shutdown(void)
{
	int ret;

	/* Shut down any subsystems that have global state */
	if ((ret = git_atomic_dec(&git__n_inits)) == 0) {
		shutdown_common();
		git__global_state_cleanup(&__state);
		memset(&__state, 0, sizeof(__state));
	}

	return ret;
}
Beispiel #5
0
int git_libgit2_shutdown(void)
{
	int ret;

	/* Shut down any subsystems that have global state */
	if ((ret = git_atomic_dec(&git__n_inits)) != 0)
		return ret;

	git__shutdown();
	git__global_state_cleanup(&__state);
	uninit_ssl();

	return 0;
}
Beispiel #6
0
static void cb__free_status(void *st)
{
	git__global_state_cleanup(st);
	git__free(st);
}