summaryrefslogtreecommitdiff
path: root/src/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream.h')
-rw-r--r--src/stream.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/stream.h b/src/stream.h
index d810e704d..0a9fc187b 100644
--- a/src/stream.h
+++ b/src/stream.h
@@ -50,4 +50,14 @@ GIT_INLINE(void) git_stream_free(git_stream *st)
st->free(st);
}
+/* Macros for locking around OpenSSL and libssh2; it assumes you have a static 'should_lock' variable */
+#define LOCK do { \
+ if (should_lock && git_mutex_lock(&git__io_mutex) < 0) { \
+ giterr_set(GITERR_NET, "failed to lock IO mutex"); \
+ return -1; \
+ } \
+} while(0)
+
+#define UNLOCK git_mutex_unlock(&git__io_mutex)
+
#endif