File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,32 @@ static int all_work_added;
74
74
/* This lock protects all the variables above. */
75
75
static pthread_mutex_t grep_mutex ;
76
76
77
+ static inline void grep_lock (void )
78
+ {
79
+ if (use_threads )
80
+ pthread_mutex_lock (& grep_mutex );
81
+ }
82
+
83
+ static inline void grep_unlock (void )
84
+ {
85
+ if (use_threads )
86
+ pthread_mutex_unlock (& grep_mutex );
87
+ }
88
+
77
89
/* Used to serialize calls to read_sha1_file. */
78
90
static pthread_mutex_t read_sha1_mutex ;
79
91
80
- #define WHEN_THREADED (x ) do { if (use_threads) (x); } while (0)
81
- #define grep_lock () WHEN_THREADED(pthread_mutex_lock(&grep_mutex))
82
- #define grep_unlock () WHEN_THREADED(pthread_mutex_unlock(&grep_mutex))
83
- #define read_sha1_lock () WHEN_THREADED(pthread_mutex_lock(&read_sha1_mutex))
84
- #define read_sha1_unlock () WHEN_THREADED(pthread_mutex_unlock(&read_sha1_mutex))
92
+ static inline void read_sha1_lock (void )
93
+ {
94
+ if (use_threads )
95
+ pthread_mutex_lock (& read_sha1_mutex );
96
+ }
97
+
98
+ static inline void read_sha1_unlock (void )
99
+ {
100
+ if (use_threads )
101
+ pthread_mutex_unlock (& read_sha1_mutex );
102
+ }
85
103
86
104
/* Signalled when a new work_item is added to todo. */
87
105
static pthread_cond_t cond_add ;
You can’t perform that action at this time.
0 commit comments