rugged 0.24.0 → 0.24.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/CMakeLists.txt +20 -9
  4. data/vendor/libgit2/deps/http-parser/http_parser.c +5 -2
  5. data/vendor/libgit2/include/git2/checkout.h +7 -0
  6. data/vendor/libgit2/include/git2/common.h +16 -1
  7. data/vendor/libgit2/include/git2/version.h +2 -2
  8. data/vendor/libgit2/src/array.h +40 -0
  9. data/vendor/libgit2/src/blame.c +8 -3
  10. data/vendor/libgit2/src/blame_git.c +20 -9
  11. data/vendor/libgit2/src/checkout.c +13 -5
  12. data/vendor/libgit2/src/commit.c +5 -4
  13. data/vendor/libgit2/src/common.h +1 -1
  14. data/vendor/libgit2/src/config_cache.c +2 -1
  15. data/vendor/libgit2/src/config_file.c +14 -20
  16. data/vendor/libgit2/src/delta-apply.c +36 -5
  17. data/vendor/libgit2/src/delta-apply.h +12 -0
  18. data/vendor/libgit2/src/describe.c +2 -1
  19. data/vendor/libgit2/src/diff_tform.c +5 -3
  20. data/vendor/libgit2/src/filebuf.c +6 -1
  21. data/vendor/libgit2/src/global.c +28 -8
  22. data/vendor/libgit2/src/global.h +1 -0
  23. data/vendor/libgit2/src/ignore.c +56 -19
  24. data/vendor/libgit2/src/index.c +27 -8
  25. data/vendor/libgit2/src/indexer.c +11 -7
  26. data/vendor/libgit2/src/iterator.c +2 -2
  27. data/vendor/libgit2/src/merge.c +1 -0
  28. data/vendor/libgit2/src/mwindow.c +20 -21
  29. data/vendor/libgit2/src/mwindow.h +1 -2
  30. data/vendor/libgit2/src/object.c +3 -6
  31. data/vendor/libgit2/src/odb.c +11 -15
  32. data/vendor/libgit2/src/odb.h +2 -1
  33. data/vendor/libgit2/src/odb_loose.c +13 -9
  34. data/vendor/libgit2/src/odb_pack.c +5 -6
  35. data/vendor/libgit2/src/oid.h +9 -0
  36. data/vendor/libgit2/src/openssl_stream.c +60 -27
  37. data/vendor/libgit2/src/openssl_stream.h +106 -0
  38. data/vendor/libgit2/src/pack-objects.c +4 -2
  39. data/vendor/libgit2/src/pack.c +10 -14
  40. data/vendor/libgit2/src/posix.c +7 -0
  41. data/vendor/libgit2/src/posix.h +1 -0
  42. data/vendor/libgit2/src/push.c +6 -6
  43. data/vendor/libgit2/src/refdb_fs.c +1 -0
  44. data/vendor/libgit2/src/refs.c +3 -0
  45. data/vendor/libgit2/src/refspec.c +4 -2
  46. data/vendor/libgit2/src/remote.c +15 -5
  47. data/vendor/libgit2/src/repository.c +29 -21
  48. data/vendor/libgit2/src/settings.c +23 -1
  49. data/vendor/libgit2/src/stransport_stream.c +15 -9
  50. data/vendor/libgit2/src/submodule.c +3 -2
  51. data/vendor/libgit2/src/sysdir.c +41 -47
  52. data/vendor/libgit2/src/sysdir.h +0 -5
  53. data/vendor/libgit2/src/tag.c +8 -2
  54. data/vendor/libgit2/src/thread-utils.h +5 -51
  55. data/vendor/libgit2/src/transport.c +2 -0
  56. data/vendor/libgit2/src/transports/http.c +2 -1
  57. data/vendor/libgit2/src/transports/smart_pkt.c +1 -0
  58. data/vendor/libgit2/src/transports/smart_protocol.c +72 -17
  59. data/vendor/libgit2/src/transports/ssh.c +32 -17
  60. data/vendor/libgit2/src/tree.c +83 -100
  61. data/vendor/libgit2/src/tree.h +4 -5
  62. data/vendor/libgit2/src/unix/map.c +5 -0
  63. data/vendor/libgit2/src/unix/pthread.h +54 -0
  64. data/vendor/libgit2/src/util.c +3 -3
  65. data/vendor/libgit2/src/win32/map.c +24 -5
  66. data/vendor/libgit2/src/win32/precompiled.h +1 -1
  67. data/vendor/libgit2/src/win32/{pthread.c → thread.c} +50 -80
  68. data/vendor/libgit2/src/win32/thread.h +62 -0
  69. data/vendor/libgit2/src/xdiff/xprepare.c +2 -1
  70. metadata +384 -394
  71. data/vendor/libgit2/src/win32/pthread.h +0 -92
@@ -17,15 +17,14 @@
17
17
  struct git_tree_entry {
18
18
  uint16_t attr;
19
19
  uint16_t filename_len;
20
- git_oid oid;
21
- bool pooled;
22
- char filename[GIT_FLEX_ARRAY];
20
+ const git_oid *oid;
21
+ const char *filename;
23
22
  };
24
23
 
25
24
  struct git_tree {
26
25
  git_object object;
27
- git_vector entries;
28
- git_pool pool;
26
+ git_odb_object *odb_obj;
27
+ git_array_t(git_tree_entry) entries;
29
28
  };
30
29
 
31
30
  struct git_treebuilder {
@@ -24,6 +24,11 @@ int git__page_size(size_t *page_size)
24
24
  return 0;
25
25
  }
26
26
 
27
+ int git__mmap_alignment(size_t *alignment)
28
+ {
29
+ return git__page_size(alignment);
30
+ }
31
+
27
32
  int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
28
33
  {
29
34
  int mprot = PROT_READ;
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
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.
6
+ */
7
+
8
+ #ifndef INCLUDE_unix_pthread_h__
9
+ #define INCLUDE_unix_pthread_h__
10
+
11
+ typedef struct {
12
+ pthread_t thread;
13
+ } git_thread;
14
+
15
+ #define git_threads_init() (void)0
16
+ #define git_thread_create(git_thread_ptr, start_routine, arg) \
17
+ pthread_create(&(git_thread_ptr)->thread, NULL, start_routine, arg)
18
+ #define git_thread_join(git_thread_ptr, status) \
19
+ pthread_join((git_thread_ptr)->thread, status)
20
+
21
+ /* Git Mutex */
22
+ #define git_mutex pthread_mutex_t
23
+ #define git_mutex_init(a) pthread_mutex_init(a, NULL)
24
+ #define git_mutex_lock(a) pthread_mutex_lock(a)
25
+ #define git_mutex_unlock(a) pthread_mutex_unlock(a)
26
+ #define git_mutex_free(a) pthread_mutex_destroy(a)
27
+
28
+ /* Git condition vars */
29
+ #define git_cond pthread_cond_t
30
+ #define git_cond_init(c) pthread_cond_init(c, NULL)
31
+ #define git_cond_free(c) pthread_cond_destroy(c)
32
+ #define git_cond_wait(c, l) pthread_cond_wait(c, l)
33
+ #define git_cond_signal(c) pthread_cond_signal(c)
34
+ #define git_cond_broadcast(c) pthread_cond_broadcast(c)
35
+
36
+ /* Pthread (-ish) rwlock
37
+ *
38
+ * This differs from normal pthreads rwlocks in two ways:
39
+ * 1. Separate APIs for releasing read locks and write locks (as
40
+ * opposed to the pure POSIX API which only has one unlock fn)
41
+ * 2. You should not use recursive read locks (i.e. grabbing a read
42
+ * lock in a thread that already holds a read lock) because the
43
+ * Windows implementation doesn't support it
44
+ */
45
+ #define git_rwlock pthread_rwlock_t
46
+ #define git_rwlock_init(a) pthread_rwlock_init(a, NULL)
47
+ #define git_rwlock_rdlock(a) pthread_rwlock_rdlock(a)
48
+ #define git_rwlock_rdunlock(a) pthread_rwlock_unlock(a)
49
+ #define git_rwlock_wrlock(a) pthread_rwlock_wrlock(a)
50
+ #define git_rwlock_wrunlock(a) pthread_rwlock_unlock(a)
51
+ #define git_rwlock_free(a) pthread_rwlock_destroy(a)
52
+ #define GIT_RWLOCK_STATIC_INIT PTHREAD_RWLOCK_INITIALIZER
53
+
54
+ #endif /* INCLUDE_unix_pthread_h__ */
@@ -122,8 +122,8 @@ int git__strtol64(int64_t *result, const char *nptr, const char **endptr, int ba
122
122
  v = c - 'A' + 10;
123
123
  if (v >= base)
124
124
  break;
125
- nn = n*base + v;
126
- if (nn < n)
125
+ nn = n * base + (neg ? -v : v);
126
+ if ((!neg && nn < n) || (neg && nn > n))
127
127
  ovfl = 1;
128
128
  n = nn;
129
129
  }
@@ -142,7 +142,7 @@ Return:
142
142
  return -1;
143
143
  }
144
144
 
145
- *result = neg ? -n : n;
145
+ *result = n;
146
146
  return 0;
147
147
  }
148
148
 
@@ -17,22 +17,41 @@ static DWORD get_page_size(void)
17
17
 
18
18
  if (!page_size) {
19
19
  GetSystemInfo(&sys);
20
- page_size = sys.dwAllocationGranularity;
20
+ page_size = sys.dwPageSize;
21
21
  }
22
22
 
23
23
  return page_size;
24
24
  }
25
25
 
26
+ static DWORD get_allocation_granularity(void)
27
+ {
28
+ static DWORD granularity;
29
+ SYSTEM_INFO sys;
30
+
31
+ if (!granularity) {
32
+ GetSystemInfo(&sys);
33
+ granularity = sys.dwAllocationGranularity;
34
+ }
35
+
36
+ return granularity;
37
+ }
38
+
26
39
  int git__page_size(size_t *page_size)
27
40
  {
28
41
  *page_size = get_page_size();
29
42
  return 0;
30
43
  }
31
44
 
45
+ int git__mmap_alignment(size_t *page_size)
46
+ {
47
+ *page_size = get_allocation_granularity();
48
+ return 0;
49
+ }
50
+
32
51
  int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
33
52
  {
34
53
  HANDLE fh = (HANDLE)_get_osfhandle(fd);
35
- DWORD page_size = get_page_size();
54
+ DWORD alignment = get_allocation_granularity();
36
55
  DWORD fmap_prot = 0;
37
56
  DWORD view_prot = 0;
38
57
  DWORD off_low = 0;
@@ -62,12 +81,12 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
62
81
  if (prot & GIT_PROT_READ)
63
82
  view_prot |= FILE_MAP_READ;
64
83
 
65
- page_start = (offset / page_size) * page_size;
84
+ page_start = (offset / alignment) * alignment;
66
85
  page_offset = offset - page_start;
67
86
 
68
- if (page_offset != 0) { /* offset must be multiple of page size */
87
+ if (page_offset != 0) { /* offset must be multiple of the allocation granularity */
69
88
  errno = EINVAL;
70
- giterr_set(GITERR_OS, "Failed to mmap. Offset must be multiple of page size");
89
+ giterr_set(GITERR_OS, "Failed to mmap. Offset must be multiple of allocation granularity");
71
90
  return -1;
72
91
  }
73
92
 
@@ -16,7 +16,7 @@
16
16
  #include <io.h>
17
17
  #include <direct.h>
18
18
  #ifdef GIT_THREADS
19
- #include "win32/pthread.h"
19
+ #include "win32/thread.h"
20
20
  #endif
21
21
 
22
22
  #include "git2.h"
@@ -5,18 +5,26 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "pthread.h"
8
+ #include "thread.h"
9
9
  #include "../global.h"
10
10
 
11
11
  #define CLEAN_THREAD_EXIT 0x6F012842
12
12
 
13
+ typedef void (WINAPI *win32_srwlock_fn)(GIT_SRWLOCK *);
14
+
15
+ static win32_srwlock_fn win32_srwlock_initialize;
16
+ static win32_srwlock_fn win32_srwlock_acquire_shared;
17
+ static win32_srwlock_fn win32_srwlock_release_shared;
18
+ static win32_srwlock_fn win32_srwlock_acquire_exclusive;
19
+ static win32_srwlock_fn win32_srwlock_release_exclusive;
20
+
13
21
  /* The thread procedure stub used to invoke the caller's procedure
14
22
  * and capture the return value for later collection. Windows will
15
23
  * only hold a DWORD, but we need to be able to store an entire
16
24
  * void pointer. This requires the indirection. */
17
25
  static DWORD WINAPI git_win32__threadproc(LPVOID lpParameter)
18
26
  {
19
- git_win32_thread *thread = lpParameter;
27
+ git_thread *thread = lpParameter;
20
28
 
21
29
  thread->result = thread->proc(thread->param);
22
30
 
@@ -25,14 +33,31 @@ static DWORD WINAPI git_win32__threadproc(LPVOID lpParameter)
25
33
  return CLEAN_THREAD_EXIT;
26
34
  }
27
35
 
28
- int git_win32__thread_create(
29
- git_win32_thread *GIT_RESTRICT thread,
30
- const pthread_attr_t *GIT_RESTRICT attr,
36
+ int git_threads_init(void)
37
+ {
38
+ HMODULE hModule = GetModuleHandleW(L"kernel32");
39
+
40
+ if (hModule) {
41
+ win32_srwlock_initialize = (win32_srwlock_fn)
42
+ GetProcAddress(hModule, "InitializeSRWLock");
43
+ win32_srwlock_acquire_shared = (win32_srwlock_fn)
44
+ GetProcAddress(hModule, "AcquireSRWLockShared");
45
+ win32_srwlock_release_shared = (win32_srwlock_fn)
46
+ GetProcAddress(hModule, "ReleaseSRWLockShared");
47
+ win32_srwlock_acquire_exclusive = (win32_srwlock_fn)
48
+ GetProcAddress(hModule, "AcquireSRWLockExclusive");
49
+ win32_srwlock_release_exclusive = (win32_srwlock_fn)
50
+ GetProcAddress(hModule, "ReleaseSRWLockExclusive");
51
+ }
52
+
53
+ return 0;
54
+ }
55
+
56
+ int git_thread_create(
57
+ git_thread *GIT_RESTRICT thread,
31
58
  void *(*start_routine)(void*),
32
59
  void *GIT_RESTRICT arg)
33
60
  {
34
- GIT_UNUSED(attr);
35
-
36
61
  thread->result = NULL;
37
62
  thread->param = arg;
38
63
  thread->proc = start_routine;
@@ -42,8 +67,8 @@ int git_win32__thread_create(
42
67
  return thread->thread ? 0 : -1;
43
68
  }
44
69
 
45
- int git_win32__thread_join(
46
- git_win32_thread *thread,
70
+ int git_thread_join(
71
+ git_thread *thread,
47
72
  void **value_ptr)
48
73
  {
49
74
  DWORD exit;
@@ -70,39 +95,32 @@ int git_win32__thread_join(
70
95
  return 0;
71
96
  }
72
97
 
73
- int pthread_mutex_init(
74
- pthread_mutex_t *GIT_RESTRICT mutex,
75
- const pthread_mutexattr_t *GIT_RESTRICT mutexattr)
98
+ int git_mutex_init(git_mutex *GIT_RESTRICT mutex)
76
99
  {
77
- GIT_UNUSED(mutexattr);
78
100
  InitializeCriticalSection(mutex);
79
101
  return 0;
80
102
  }
81
103
 
82
- int pthread_mutex_destroy(pthread_mutex_t *mutex)
104
+ int git_mutex_free(git_mutex *mutex)
83
105
  {
84
106
  DeleteCriticalSection(mutex);
85
107
  return 0;
86
108
  }
87
109
 
88
- int pthread_mutex_lock(pthread_mutex_t *mutex)
110
+ int git_mutex_lock(git_mutex *mutex)
89
111
  {
90
112
  EnterCriticalSection(mutex);
91
113
  return 0;
92
114
  }
93
115
 
94
- int pthread_mutex_unlock(pthread_mutex_t *mutex)
116
+ int git_mutex_unlock(git_mutex *mutex)
95
117
  {
96
118
  LeaveCriticalSection(mutex);
97
119
  return 0;
98
120
  }
99
121
 
100
- int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
122
+ int git_cond_init(git_cond *cond)
101
123
  {
102
- /* We don't support non-default attributes. */
103
- if (attr)
104
- return EINVAL;
105
-
106
124
  /* This is an auto-reset event. */
107
125
  *cond = CreateEventW(NULL, FALSE, FALSE, NULL);
108
126
  assert(*cond);
@@ -112,7 +130,7 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
112
130
  return *cond ? 0 : ENOMEM;
113
131
  }
114
132
 
115
- int pthread_cond_destroy(pthread_cond_t *cond)
133
+ int git_cond_free(git_cond *cond)
116
134
  {
117
135
  BOOL closed;
118
136
 
@@ -127,7 +145,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
127
145
  return 0;
128
146
  }
129
147
 
130
- int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
148
+ int git_cond_wait(git_cond *cond, git_mutex *mutex)
131
149
  {
132
150
  int error;
133
151
  DWORD wait_result;
@@ -136,7 +154,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
136
154
  return EINVAL;
137
155
 
138
156
  /* The caller must be holding the mutex. */
139
- error = pthread_mutex_unlock(mutex);
157
+ error = git_mutex_unlock(mutex);
140
158
 
141
159
  if (error)
142
160
  return error;
@@ -145,10 +163,10 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
145
163
  assert(WAIT_OBJECT_0 == wait_result);
146
164
  GIT_UNUSED(wait_result);
147
165
 
148
- return pthread_mutex_lock(mutex);
166
+ return git_mutex_lock(mutex);
149
167
  }
150
168
 
151
- int pthread_cond_signal(pthread_cond_t *cond)
169
+ int git_cond_signal(git_cond *cond)
152
170
  {
153
171
  BOOL signaled;
154
172
 
@@ -162,36 +180,8 @@ int pthread_cond_signal(pthread_cond_t *cond)
162
180
  return 0;
163
181
  }
164
182
 
165
- /* pthread_cond_broadcast is not implemented because doing so with just
166
- * Win32 events is quite complicated, and no caller in libgit2 uses it
167
- * yet.
168
- */
169
- int pthread_num_processors_np(void)
170
- {
171
- DWORD_PTR p, s;
172
- int n = 0;
173
-
174
- if (GetProcessAffinityMask(GetCurrentProcess(), &p, &s))
175
- for (; p; p >>= 1)
176
- n += p&1;
177
-
178
- return n ? n : 1;
179
- }
180
-
181
- typedef void (WINAPI *win32_srwlock_fn)(GIT_SRWLOCK *);
182
-
183
- static win32_srwlock_fn win32_srwlock_initialize;
184
- static win32_srwlock_fn win32_srwlock_acquire_shared;
185
- static win32_srwlock_fn win32_srwlock_release_shared;
186
- static win32_srwlock_fn win32_srwlock_acquire_exclusive;
187
- static win32_srwlock_fn win32_srwlock_release_exclusive;
188
-
189
- int pthread_rwlock_init(
190
- pthread_rwlock_t *GIT_RESTRICT lock,
191
- const pthread_rwlockattr_t *GIT_RESTRICT attr)
183
+ int git_rwlock_init(git_rwlock *GIT_RESTRICT lock)
192
184
  {
193
- GIT_UNUSED(attr);
194
-
195
185
  if (win32_srwlock_initialize)
196
186
  win32_srwlock_initialize(&lock->native.srwl);
197
187
  else
@@ -200,7 +190,7 @@ int pthread_rwlock_init(
200
190
  return 0;
201
191
  }
202
192
 
203
- int pthread_rwlock_rdlock(pthread_rwlock_t *lock)
193
+ int git_rwlock_rdlock(git_rwlock *lock)
204
194
  {
205
195
  if (win32_srwlock_acquire_shared)
206
196
  win32_srwlock_acquire_shared(&lock->native.srwl);
@@ -210,7 +200,7 @@ int pthread_rwlock_rdlock(pthread_rwlock_t *lock)
210
200
  return 0;
211
201
  }
212
202
 
213
- int pthread_rwlock_rdunlock(pthread_rwlock_t *lock)
203
+ int git_rwlock_rdunlock(git_rwlock *lock)
214
204
  {
215
205
  if (win32_srwlock_release_shared)
216
206
  win32_srwlock_release_shared(&lock->native.srwl);
@@ -220,7 +210,7 @@ int pthread_rwlock_rdunlock(pthread_rwlock_t *lock)
220
210
  return 0;
221
211
  }
222
212
 
223
- int pthread_rwlock_wrlock(pthread_rwlock_t *lock)
213
+ int git_rwlock_wrlock(git_rwlock *lock)
224
214
  {
225
215
  if (win32_srwlock_acquire_exclusive)
226
216
  win32_srwlock_acquire_exclusive(&lock->native.srwl);
@@ -230,7 +220,7 @@ int pthread_rwlock_wrlock(pthread_rwlock_t *lock)
230
220
  return 0;
231
221
  }
232
222
 
233
- int pthread_rwlock_wrunlock(pthread_rwlock_t *lock)
223
+ int git_rwlock_wrunlock(git_rwlock *lock)
234
224
  {
235
225
  if (win32_srwlock_release_exclusive)
236
226
  win32_srwlock_release_exclusive(&lock->native.srwl);
@@ -240,30 +230,10 @@ int pthread_rwlock_wrunlock(pthread_rwlock_t *lock)
240
230
  return 0;
241
231
  }
242
232
 
243
- int pthread_rwlock_destroy(pthread_rwlock_t *lock)
233
+ int git_rwlock_free(git_rwlock *lock)
244
234
  {
245
235
  if (!win32_srwlock_initialize)
246
236
  DeleteCriticalSection(&lock->native.csec);
247
237
  git__memzero(lock, sizeof(*lock));
248
238
  return 0;
249
239
  }
250
-
251
- int win32_pthread_initialize(void)
252
- {
253
- HMODULE hModule = GetModuleHandleW(L"kernel32");
254
-
255
- if (hModule) {
256
- win32_srwlock_initialize = (win32_srwlock_fn)
257
- GetProcAddress(hModule, "InitializeSRWLock");
258
- win32_srwlock_acquire_shared = (win32_srwlock_fn)
259
- GetProcAddress(hModule, "AcquireSRWLockShared");
260
- win32_srwlock_release_shared = (win32_srwlock_fn)
261
- GetProcAddress(hModule, "ReleaseSRWLockShared");
262
- win32_srwlock_acquire_exclusive = (win32_srwlock_fn)
263
- GetProcAddress(hModule, "AcquireSRWLockExclusive");
264
- win32_srwlock_release_exclusive = (win32_srwlock_fn)
265
- GetProcAddress(hModule, "ReleaseSRWLockExclusive");
266
- }
267
-
268
- return 0;
269
- }
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
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.
6
+ */
7
+
8
+ #ifndef INCLUDE_win32_thread_h__
9
+ #define INCLUDE_win32_thread_h__
10
+
11
+ #include "../common.h"
12
+
13
+ #if defined (_MSC_VER)
14
+ # define GIT_RESTRICT __restrict
15
+ #else
16
+ # define GIT_RESTRICT __restrict__
17
+ #endif
18
+
19
+ typedef struct {
20
+ HANDLE thread;
21
+ void *(*proc)(void *);
22
+ void *param;
23
+ void *result;
24
+ } git_thread;
25
+
26
+ typedef CRITICAL_SECTION git_mutex;
27
+ typedef HANDLE git_cond;
28
+
29
+ typedef struct { void *Ptr; } GIT_SRWLOCK;
30
+
31
+ typedef struct {
32
+ union {
33
+ GIT_SRWLOCK srwl;
34
+ CRITICAL_SECTION csec;
35
+ } native;
36
+ } git_rwlock;
37
+
38
+ int git_threads_init(void);
39
+
40
+ int git_thread_create(git_thread *GIT_RESTRICT,
41
+ void *(*) (void *),
42
+ void *GIT_RESTRICT);
43
+ int git_thread_join(git_thread *, void **);
44
+
45
+ int git_mutex_init(git_mutex *GIT_RESTRICT mutex);
46
+ int git_mutex_free(git_mutex *);
47
+ int git_mutex_lock(git_mutex *);
48
+ int git_mutex_unlock(git_mutex *);
49
+
50
+ int git_cond_init(git_cond *);
51
+ int git_cond_free(git_cond *);
52
+ int git_cond_wait(git_cond *, git_mutex *);
53
+ int git_cond_signal(git_cond *);
54
+
55
+ int git_rwlock_init(git_rwlock *GIT_RESTRICT lock);
56
+ int git_rwlock_rdlock(git_rwlock *);
57
+ int git_rwlock_rdunlock(git_rwlock *);
58
+ int git_rwlock_wrlock(git_rwlock *);
59
+ int git_rwlock_wrunlock(git_rwlock *);
60
+ int git_rwlock_free(git_rwlock *);
61
+
62
+ #endif /* INCLUDE_win32_thread_h__ */