summaryrefslogtreecommitdiff
path: root/src/thread-utils.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-08-22 14:34:21 -0700
committerRussell Belfer <rb@github.com>2013-08-22 14:34:21 -0700
commiteb868b1e98d7cea8796f9b92be04843a7f819e5e (patch)
tree82170981684b0f828a6e0cfbb4edfd63f2a00737 /src/thread-utils.h
parent972bb689c4a69ba5a5dfaeebacc7198622c4f051 (diff)
downloadlibgit2-eb868b1e98d7cea8796f9b92be04843a7f819e5e.tar.gz
Drop support for THREADSAFE on Windows XP
This makes libgit2 require Windows Vista or newer if it is going to be compiled with the THREADSAFE option
Diffstat (limited to 'src/thread-utils.h')
-rw-r--r--src/thread-utils.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/thread-utils.h b/src/thread-utils.h
index 819e24e7b..371dc0b26 100644
--- a/src/thread-utils.h
+++ b/src/thread-utils.h
@@ -40,6 +40,10 @@ typedef git_atomic git_atomic_ssize;
#ifdef GIT_THREADS
+#if defined(GIT_WIN32) && _WIN32_WINNT < 0x0600
+# error "Unsupported Windows version for thread support"
+#endif
+
#define git_thread pthread_t
#define git_thread_create(thread, attr, start_routine, arg) \
pthread_create(thread, attr, start_routine, arg)
@@ -62,7 +66,15 @@ typedef git_atomic git_atomic_ssize;
#define git_cond_signal(c) pthread_cond_signal(c)
#define git_cond_broadcast(c) pthread_cond_broadcast(c)
-/* Pthreads rwlock */
+/* Pthread (-ish) rwlock
+ *
+ * This differs from normal pthreads rwlocks in two ways:
+ * 1. Separate APIs for releasing read locks and write locks (as
+ * opposed to the pure POSIX API which only has one unlock fn)
+ * 2. You should not use recursive read locks (i.e. grabbing a read
+ * lock in a thread that already holds a read lock) because the
+ * Windows implementation doesn't support it
+ */
#define git_rwlock pthread_rwlock_t
#define git_rwlock_init(a) pthread_rwlock_init(a, NULL)
#define git_rwlock_rdlock(a) pthread_rwlock_rdlock(a)