global.h 736 Bytes
Newer Older
1
/*
Edward Thomson committed
2
 * Copyright (C) the libgit2 contributors. All rights reserved.
3 4 5 6 7 8 9 10
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
#ifndef INCLUDE_global_h__
#define INCLUDE_global_h__

#include "mwindow.h"
11
#include "hash.h"
12

13 14 15 16
#if defined(GIT_THREADS) && defined(_MSC_VER)
# define GIT_MEMORY_BARRIER MemoryBarrier()
#elif defined(GIT_THREADS)
# define GIT_MEMORY_BARRIER __sync_synchronize()
17 18
#else
# define GIT_MEMORY_BARRIER /* noop */
19 20
#endif

21
typedef struct {
22 23
	git_error *last_error;
	git_error error_t;
24 25 26 27
} git_global_st;

git_global_st *git__global_state(void);

28 29
extern git_mutex git__mwindow_mutex;

30 31 32
#define GIT_GLOBAL (git__global_state())

#endif