- fprintf(stderr, "[%ld] pthread_mutex_lock: %s\n", context->count, strerror(res));
- abort();
+ T_ASSERT_POSIX_ZERO(res, "[%ld] pthread_mutex_lock", context->count);
}
if (context->count > 0) {
++context->waiters;
res = pthread_cond_wait(&context->cond, &context->mutex);
if (res) {
}
if (context->count > 0) {
++context->waiters;
res = pthread_cond_wait(&context->cond, &context->mutex);
if (res) {
- fprintf(stderr, "[%ld] pthread_rwlock_unlock: %s\n", context->count, strerror(res));
- abort();
+ T_ASSERT_POSIX_ZERO(res, "[%ld] pthread_rwlock_unlock", context->count);
- fprintf(stderr, "[%ld] pthread_mutex_unlock: %s\n", context->count, strerror(res));
- abort();
+ T_ASSERT_POSIX_ZERO(res, "[%ld] pthread_mutex_unlock", context->count);
{
struct context context = {
.cond = PTHREAD_COND_INITIALIZER,
.mutex = PTHREAD_MUTEX_INITIALIZER,
.waiters = 0,
{
struct context context = {
.cond = PTHREAD_COND_INITIALIZER,
.mutex = PTHREAD_MUTEX_INITIALIZER,
.waiters = 0,
- res = pthread_create(&p[i], NULL, wait_thread, &context);
- assert(res == 0);
+ T_ASSERT_POSIX_ZERO(pthread_create(&p[i], NULL, wait_thread, &context), NULL);
- fprintf(stderr, "[%ld] pthread_mutex_lock: %s\n", context.count, strerror(res));
- abort();
+ T_ASSERT_POSIX_ZERO(res, "[%ld] pthread_mutex_lock", context.count);
- fprintf(stderr, "[%ld] %s: %s\n", context.count, str, strerror(res));
- abort();
+ T_ASSERT_POSIX_ZERO(res, "[%ld] %s", context.count, str);
- fprintf(stderr, "[%ld] pthread_mutex_unlock: %s\n", context.count, strerror(res));
- abort();
+ T_ASSERT_POSIX_ZERO(res, "[%ld] pthread_mutex_unlock", context.count);