Ensure pthread condition variable attributes are cleaned up.

This commit is contained in:
Christopher Kohlhoff 2021-01-05 09:33:10 +11:00
parent ce9e7d999a
commit da1cf294d9

View File

@ -37,10 +37,14 @@ posix_event::posix_event()
#else // (defined(__MACH__) && defined(__APPLE__))
// || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
::pthread_condattr_t attr;
::pthread_condattr_init(&attr);
int error = ::pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
int error = ::pthread_condattr_init(&attr);
if (error == 0)
error = ::pthread_cond_init(&cond_, &attr);
{
error = ::pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
if (error == 0)
error = ::pthread_cond_init(&cond_, &attr);
::pthread_condattr_destroy(&attr);
}
#endif // (defined(__MACH__) && defined(__APPLE__))
// || (defined(__ANDROID__) && (__ANDROID_API__ < 21))