summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index 3653bb333c..4f1b0251b0 100644
--- a/grep.h
+++ b/grep.h
@@ -139,6 +139,23 @@ extern int grep_threads_ok(const struct grep_opt *opt);
*/
extern int grep_use_locks;
extern pthread_mutex_t grep_attr_mutex;
+extern pthread_mutex_t grep_read_mutex;
+
+static inline void grep_read_lock(void)
+{
+ if (grep_use_locks)
+ pthread_mutex_lock(&grep_read_mutex);
+}
+
+static inline void grep_read_unlock(void)
+{
+ if (grep_use_locks)
+ pthread_mutex_unlock(&grep_read_mutex);
+}
+
+#else
+#define grep_read_lock()
+#define grep_read_unlock()
#endif
#endif