2 * Copyright (C) the libgit2 contributors. All rights reserved.
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
8 #ifndef INCLUDE_win32_thread_h__
9 #define INCLUDE_win32_thread_h__
13 #if defined (_MSC_VER)
14 # define GIT_RESTRICT __restrict
16 # define GIT_RESTRICT __restrict__
21 void *(*proc
)(void *);
26 typedef CRITICAL_SECTION git_mutex
;
27 typedef HANDLE git_cond
;
29 typedef struct { void *Ptr
; } GIT_SRWLOCK
;
34 CRITICAL_SECTION csec
;
38 int git_threads_init(void);
40 int git_thread_create(git_thread
*GIT_RESTRICT
,
43 int git_thread_join(git_thread
*, void **);
44 size_t git_thread_currentid(void);
45 void git_thread_exit(void *);
47 int git_mutex_init(git_mutex
*GIT_RESTRICT mutex
);
48 int git_mutex_free(git_mutex
*);
49 int git_mutex_lock(git_mutex
*);
50 int git_mutex_unlock(git_mutex
*);
52 int git_cond_init(git_cond
*);
53 int git_cond_free(git_cond
*);
54 int git_cond_wait(git_cond
*, git_mutex
*);
55 int git_cond_signal(git_cond
*);
57 int git_rwlock_init(git_rwlock
*GIT_RESTRICT lock
);
58 int git_rwlock_rdlock(git_rwlock
*);
59 int git_rwlock_rdunlock(git_rwlock
*);
60 int git_rwlock_wrlock(git_rwlock
*);
61 int git_rwlock_wrunlock(git_rwlock
*);
62 int git_rwlock_free(git_rwlock
*);