Skip to content

Commit

Permalink
macos: apple is almost unix, support pthreads in gu
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Prisyazhnyy <[email protected]>
  • Loading branch information
sitano committed Aug 28, 2024
1 parent b52c519 commit 78dfe02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions galerautils/src/gu_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ int gu_barrier_init_SYS (gu_barrier_t_SYS *barrier,
errno = EINVAL;
return -1;
}
if(gu_mutex_init_SYS (&barrier->mutex, 0) < 0)
if(gu_mutex_init_SYS (NULL, &barrier->mutex) < 0)
{
return -1;
}
if(gu_cond_init_SYS (&barrier->cond, 0) < 0)
if(gu_cond_init_SYS (NULL, &barrier->cond) < 0)
{
gu_mutex_destroy_SYS (&barrier->mutex);
return -1;
Expand All @@ -279,13 +279,13 @@ int gu_barrier_wait_SYS (gu_barrier_t_SYS *barrier)
barrier->count = 0;
gu_cond_broadcast_SYS (&barrier->cond);
gu_mutex_unlock_SYS (&barrier->mutex);
return GU_BARRIER_THREAD_SYS;
return GU_BARRIER_SERIAL_THREAD_SYS;
}
else
{
gu_cond_wait_SYS (&barrier->cond, &(barrier->mutex));
gu_mutex_unlock_SYS (&barrier->mutex);
return !GU_BARRIER_THREAD_SYS;
return !GU_BARRIER_SERIAL_THREAD_SYS;
}
}

Expand Down
4 changes: 0 additions & 4 deletions galerautils/src/gu_threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include "gu_types.h" // bool

#if __unix__

#include <pthread.h>
#include <assert.h>

Expand Down Expand Up @@ -318,8 +316,6 @@ typedef pthread_barrier_t gu_barrier_t_SYS;

#endif /* native POSIX barriers */

#endif /* __unix__ */

/**
* Depending on compile-time flags application will either use
* normal or debug version of the API calls
Expand Down

0 comments on commit 78dfe02

Please sign in to comment.