Check for pthread_condattr_init added to configure script.
This commit is contained in:
parent
c33d4f29bc
commit
866dc0134a
|
@ -297,6 +297,8 @@ AC_TRY_RUN(
|
||||||
[AC_DEFINE([HAVE_CONDATTR_CLOCK_MONOTONIC])]
|
[AC_DEFINE([HAVE_CONDATTR_CLOCK_MONOTONIC])]
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
dnl check if we actually are able to configure attributes on cond vars
|
||||||
|
AC_CHECK_FUNCS(pthread_condattr_init)
|
||||||
dnl check if native rwlocks are available
|
dnl check if native rwlocks are available
|
||||||
AC_CHECK_FUNCS(pthread_rwlock_init)
|
AC_CHECK_FUNCS(pthread_rwlock_init)
|
||||||
LIBS=$saved_LIBS
|
LIBS=$saved_LIBS
|
||||||
|
|
|
@ -341,7 +341,6 @@ condvar_t *condvar_create(condvar_type_t type)
|
||||||
case CONDVAR_TYPE_DEFAULT:
|
case CONDVAR_TYPE_DEFAULT:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
pthread_condattr_t condattr;
|
|
||||||
private_condvar_t *this = malloc_thing(private_condvar_t);
|
private_condvar_t *this = malloc_thing(private_condvar_t);
|
||||||
|
|
||||||
this->public.wait = (void(*)(condvar_t*, mutex_t *mutex))_wait;
|
this->public.wait = (void(*)(condvar_t*, mutex_t *mutex))_wait;
|
||||||
|
@ -351,12 +350,17 @@ condvar_t *condvar_create(condvar_type_t type)
|
||||||
this->public.broadcast = (void(*)(condvar_t*))broadcast;
|
this->public.broadcast = (void(*)(condvar_t*))broadcast;
|
||||||
this->public.destroy = (void(*)(condvar_t*))condvar_destroy;
|
this->public.destroy = (void(*)(condvar_t*))condvar_destroy;
|
||||||
|
|
||||||
pthread_condattr_init(&condattr);
|
#ifdef HAVE_PTHREAD_CONDATTR_INIT
|
||||||
|
{
|
||||||
|
pthread_condattr_t condattr;
|
||||||
|
pthread_condattr_init(&condattr);
|
||||||
#ifdef HAVE_CONDATTR_CLOCK_MONOTONIC
|
#ifdef HAVE_CONDATTR_CLOCK_MONOTONIC
|
||||||
pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
|
pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
|
||||||
|
#endif
|
||||||
|
pthread_cond_init(&this->condvar, &condattr);
|
||||||
|
pthread_condattr_destroy(&condattr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
pthread_cond_init(&this->condvar, &condattr);
|
|
||||||
pthread_condattr_destroy(&condattr);
|
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue