Skip to content

Commit ba3a04e

Browse files
committed
macos: fix gu_cond usage for darwin after 09848b6
the patch 09848b6 by Jan from 2021-11-11 14:22:24 +0200 that swapped the order of the arguments to gu_mutex_init_SYS. so now its `gu_mutex_init_SYS(const wsrep_mutex_key_t* key, gu_mutex_t_SYS *mutex)` so that for keyless mutexes its using (NULL, &mutex). the patch replaced `#define gu_mutex_init_SYS pthread_mutex_init` with its own impl that has different args (key, mutex) Signed-off-by: Ivan Prisyazhnyy <[email protected]>
1 parent 5db72da commit ba3a04e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

galerautils/src/gu_threads.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ int gu_barrier_init_SYS (gu_barrier_t_SYS *barrier,
248248
errno = EINVAL;
249249
return -1;
250250
}
251-
if(gu_mutex_init_SYS (&barrier->mutex, 0) < 0)
251+
if(gu_mutex_init_SYS (NULL, &barrier->mutex) < 0)
252252
{
253253
return -1;
254254
}
255-
if(gu_cond_init_SYS (&barrier->cond, 0) < 0)
255+
if(gu_cond_init_SYS (NULL, &barrier->cond) < 0)
256256
{
257257
gu_mutex_destroy_SYS (&barrier->mutex);
258258
return -1;
@@ -279,13 +279,13 @@ int gu_barrier_wait_SYS (gu_barrier_t_SYS *barrier)
279279
barrier->count = 0;
280280
gu_cond_broadcast_SYS (&barrier->cond);
281281
gu_mutex_unlock_SYS (&barrier->mutex);
282-
return GU_BARRIER_THREAD_SYS;
282+
return GU_BARRIER_SERIAL_THREAD_SYS;
283283
}
284284
else
285285
{
286286
gu_cond_wait_SYS (&barrier->cond, &(barrier->mutex));
287287
gu_mutex_unlock_SYS (&barrier->mutex);
288-
return !GU_BARRIER_THREAD_SYS;
288+
return !GU_BARRIER_SERIAL_THREAD_SYS;
289289
}
290290
}
291291

galerautils/src/gu_threads.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "gu_types.h" // bool
1313

14-
#if __unix__
14+
#if defined(__unix__) || defined(__APPLE__)
1515

1616
#include <pthread.h>
1717
#include <assert.h>
@@ -318,7 +318,7 @@ typedef pthread_barrier_t gu_barrier_t_SYS;
318318

319319
#endif /* native POSIX barriers */
320320

321-
#endif /* __unix__ */
321+
#endif /* defined(__unix__) || defined(__APPLE__) */
322322

323323
/**
324324
* Depending on compile-time flags application will either use

0 commit comments

Comments
 (0)