Lines Matching full:assert_eq
47 ASSERT_EQ(0, pthread_key_create(&key, NULL));
48 ASSERT_EQ(0, pthread_key_delete(key));
50 ASSERT_EQ(EINVAL, pthread_key_delete(key));
60 ASSERT_EQ(sysconf_max, PTHREAD_KEYS_MAX);
78 ASSERT_EQ(0, pthread_key_create(&key, NULL)) << i << " of " << nkeys;
80 ASSERT_EQ(0, pthread_setspecific(key, reinterpret_cast<void*>(i)));
84 ASSERT_EQ(reinterpret_cast<void*>(i), pthread_getspecific(keys.back()));
87 ASSERT_EQ(0, pthread_key_delete(key));
115 ASSERT_EQ(EAGAIN, rv);
121 ASSERT_EQ(0, pthread_key_create(&key, NULL));
122 ASSERT_EQ(0, pthread_setspecific(key, expected));
123 ASSERT_EQ(expected, pthread_getspecific(key));
124 ASSERT_EQ(0, pthread_key_delete(key));
126 ASSERT_EQ(NULL, pthread_getspecific(key));
128 ASSERT_EQ(EINVAL, pthread_setspecific(key, expected));
134 ASSERT_EQ(0, pthread_key_create(&key, NULL));
135 ASSERT_EQ(0, pthread_setspecific(key, expected));
136 ASSERT_EQ(expected, pthread_getspecific(key));
143 ASSERT_EQ(expected, pthread_getspecific(key));
148 ASSERT_EQ(pid, waitpid(pid, &status, 0));
150 ASSERT_EQ(99, WEXITSTATUS(status));
152 ASSERT_EQ(expected, pthread_getspecific(key));
153 ASSERT_EQ(0, pthread_key_delete(key));
162 ASSERT_EQ(0, pthread_key_create(&key, NULL));
170 ASSERT_EQ(0, pthread_attr_init(&attr));
171 ASSERT_EQ(0, pthread_attr_setstack(&attr, stack, stack_size));
174 ASSERT_EQ(0, pthread_create(&t, &attr, DirtyKeyFn, &key));
177 ASSERT_EQ(0, pthread_join(t, &result));
178 ASSERT_EQ(nullptr, result); // Not ~0!
180 ASSERT_EQ(0, munmap(stack, stack_size));
181 ASSERT_EQ(0, pthread_key_delete(key));
189 ASSERT_EQ(nullptr, pthread_getspecific(key));
190 ASSERT_EQ(EINVAL, pthread_setspecific(key, nullptr));
191 ASSERT_EQ(EINVAL, pthread_key_delete(key));
236 ASSERT_EQ(0, pthread_getattr_np(t, &attr));
238 ASSERT_EQ(0, pthread_attr_getdetachstate(&attr, &detach_state));
240 ASSERT_EQ(is_detached, (detach_state == PTHREAD_CREATE_DETACHED));
244 ASSERT_EQ(0, pthread_create(&t, NULL, IdFn, NULL));
245 ASSERT_EQ(0, pthread_join(t, NULL));
252 ASSERT_EQ(0, pthread_create(&t, NULL, IdFn, expected_result));
255 ASSERT_EQ(0, pthread_join(t, &result));
256 ASSERT_EQ(expected_result, result);
261 ASSERT_EQ(0, pthread_attr_init(&attributes));
262 ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, static_cast<size_t>(-1) & ~(getpagesize() - 1)));
265 ASSERT_EQ(EAGAIN, pthread_create(&t, &attributes, IdFn, NULL));
272 ASSERT_EQ(0, pthread_create(&t1, NULL, spinhelper.GetFunction(), NULL));
275 ASSERT_EQ(0, pthread_detach(t1));
279 ASSERT_EQ(EINVAL, pthread_join(t1, NULL));
286 ASSERT_EQ(0, pthread_create(&t1, NULL, spinhelper.GetFunction(), NULL));
290 ASSERT_EQ(0, pthread_create(&t2, NULL, JoinFn, reinterpret_cast<void*>(t1)));
295 ASSERT_EQ(EINVAL, pthread_detach(t1));
297 ASSERT_EQ(0, pthread_detach(t1));
305 ASSERT_EQ(0, pthread_join(t2, &join_result));
306 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result));
310 ASSERT_EQ(EDEADLK, pthread_join(pthread_self(), NULL));
320 ASSERT_EQ(0, pthread_mutex_init(&data.mutex, NULL));
321 ASSERT_EQ(0, pthread_mutex_lock(&data.mutex));
324 ASSERT_EQ(0, pthread_create(&t, NULL, TestBug37410::thread_fn, reinterpret_cast<void*>(&data)));
327 ASSERT_EQ(0, pthread_mutex_lock(&data.mutex));
328 ASSERT_EQ(0, pthread_mutex_unlock(&data.mutex));
368 ASSERT_EQ(0, pthread_sigmask(SIG_BLOCK, NULL, &original_set));
375 ASSERT_EQ(0, pthread_sigmask(SIG_BLOCK, &set, NULL));
380 ASSERT_EQ(0, pthread_sigmask(SIG_BLOCK, NULL, &final_set));
384 ASSERT_EQ(0, sigprocmask(SIG_BLOCK, NULL, &final_set));
390 ASSERT_EQ(0, pthread_create(&signal_thread, NULL, SignalHandlerFn, &received_signal));
397 ASSERT_EQ(0, pthread_join(signal_thread, &join_result));
398 ASSERT_EQ(SIGUSR1, received_signal);
399 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result));
402 ASSERT_EQ(0, pthread_sigmask(SIG_SETMASK, &original_set, NULL));
407 ASSERT_EQ(0, pthread_setname_np(pthread_self(), "123456789012345"));
408 ASSERT_EQ(ERANGE, pthread_setname_np(pthread_self(), "1234567890123456"));
412 ASSERT_EQ(0, pthread_setname_np(pthread_self(), "short 1"));
419 ASSERT_EQ(0, pthread_create(&t1, NULL, spinhelper.GetFunction(), NULL));
420 ASSERT_EQ(0, pthread_setname_np(t1, "short 2"));
428 ASSERT_EQ(ENOENT, pthread_setname_np(dead_thread, "short 3"));
433 ASSERT_EQ(0, pthread_kill(pthread_self(), 0));
437 ASSERT_EQ(EINVAL, pthread_kill(pthread_self(), -1));
442 ASSERT_EQ(SIGALRM, signal_number);
445 ASSERT_EQ(0, pthread_kill(pthread_self(), SIGALRM));
451 ASSERT_EQ(0, pthread_kill(pthread_self(), SIGALRM));
458 ASSERT_EQ(ESRCH, pthread_detach(dead_thread));
465 ASSERT_EQ(0, pthread_create(&t, NULL, spinhelper.GetFunction(), NULL));
468 ASSERT_EQ(0, pthread_getcpuclockid(t, &c));
470 ASSERT_EQ(0, clock_gettime(c, &ts));
478 ASSERT_EQ(ESRCH, pthread_getcpuclockid(dead_thread, &c));
487 ASSERT_EQ(ESRCH, pthread_getschedparam(dead_thread, &policy, ¶m));
496 ASSERT_EQ(ESRCH, pthread_setschedparam(dead_thread, policy, ¶m));
503 ASSERT_EQ(ESRCH, pthread_join(dead_thread, NULL));
510 ASSERT_EQ(ESRCH, pthread_kill(dead_thread, 0));
517 ASSERT_EQ(0, pthread_create(&t1, NULL, spinhelper.GetFunction(), NULL));
520 ASSERT_EQ(0, pthread_create(&t2, NULL, JoinFn, reinterpret_cast<void*>(t1)));
525 ASSERT_EQ(EINVAL, pthread_join(t1, NULL));
531 ASSERT_EQ(0, pthread_join(t2, &join_result));
532 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(join_result));
547 ASSERT_EQ(0, pthread_create(&t, &a, IdFn, NULL));
548 ASSERT_EQ(0, pthread_join(t, NULL));
549 ASSERT_EQ(0, munmap(stack, stack_size));
585 ASSERT_EQ(0, pthread_attr_init(&attributes));
589 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &default_guard_size));
592 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 128));
594 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size));
595 ASSERT_EQ(128U, guard_size);
596 ASSERT_EQ(4096U, GetActualGuardSize(attributes));
599 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 32*1024));
600 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size));
601 ASSERT_EQ(32*1024U, guard_size);
604 ASSERT_EQ(0, pthread_attr_setguardsize(&attributes, 32*1024 + 1));
605 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size));
606 ASSERT_EQ(32*1024U + 1, guard_size);
611 ASSERT_EQ(0, pthread_attr_init(&attributes));
615 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &default_stack_size));
618 ASSERT_EQ(EINVAL, pthread_attr_setstacksize(&attributes, 128));
620 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size));
621 ASSERT_EQ(default_stack_size, stack_size);
625 ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, 32*1024));
626 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size));
627 ASSERT_EQ(32*1024U, stack_size);
631 ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, 32*1024 + 1));
632 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size));
633 ASSERT_EQ(32*1024U + 1, stack_size);
638 ASSERT_EQ(GetActualStackSize(attributes), 32*1024U);
644 ASSERT_EQ(0, pthread_rwlockattr_init(&attr));
648 ASSERT_EQ(0, pthread_rwlockattr_setpshared(&attr, pshared_value_array[i]));
650 ASSERT_EQ(0, pthread_rwlockattr_getpshared(&attr, &pshared));
651 ASSERT_EQ(pshared_value_array[i], pshared);
657 ASSERT_EQ(0, pthread_rwlockattr_setkind_np(&attr, kind_array[i]));
659 ASSERT_EQ(0, pthread_rwlockattr_getkind_np(&attr, &kind));
660 ASSERT_EQ(kind_array[i], kind);
663 ASSERT_EQ(0, pthread_rwlockattr_destroy(&attr));
669 ASSERT_EQ(0, pthread_rwlock_init(&lock2, NULL));
670 ASSERT_EQ(0, memcmp(&lock1, &lock2, sizeof(lock1)));
675 ASSERT_EQ(0, pthread_rwlock_init(&l, NULL));
678 ASSERT_EQ(0, pthread_rwlock_rdlock(&l));
679 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
682 ASSERT_EQ(0, pthread_rwlock_rdlock(&l));
683 ASSERT_EQ(0, pthread_rwlock_rdlock(&l));
684 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
685 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
688 ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
689 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
692 ASSERT_EQ(0, pthread_rwlock_trywrlock(&l));
693 ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&l));
694 ASSERT_EQ(EBUSY, pthread_rwlock_tryrdlock(&l));
695 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
698 ASSERT_EQ(0, pthread_rwlock_tryrdlock(&l));
699 ASSERT_EQ(0, pthread_rwlock_tryrdlock(&l));
700 ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&l));
701 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
702 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
705 ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
706 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
709 ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
710 ASSERT_EQ(EDEADLK, pthread_rwlock_rdlock(&l));
711 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
714 ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
715 ASSERT_EQ(EDEADLK, pthread_rwlock_wrlock(&l));
716 ASSERT_EQ(0, pthread_rwlock_unlock(&l));
718 ASSERT_EQ(0, pthread_rwlock_destroy(&l));
752 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_INITIALIZED, arg->progress);
755 ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&arg->lock));
756 ASSERT_EQ(0, pthread_rwlock_wrlock(&arg->lock));
757 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_RELEASED, arg->progress);
758 ASSERT_EQ(0, pthread_rwlock_unlock(&arg->lock));
765 ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, NULL));
766 ASSERT_EQ(0, pthread_rwlock_rdlock(&wakeup_arg.lock));
771 ASSERT_EQ(0, pthread_create(&thread, NULL,
774 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, wakeup_arg.progress);
777 ASSERT_EQ(0, pthread_rwlock_unlock(&wakeup_arg.lock));
779 ASSERT_EQ(0, pthread_join(thread, NULL));
780 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_ACCESSED, wakeup_arg.progress);
781 ASSERT_EQ(0, pthread_rwlock_destroy(&wakeup_arg.lock));
786 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_INITIALIZED, arg->progress);
789 ASSERT_EQ(EBUSY, pthread_rwlock_tryrdlock(&arg->lock));
790 ASSERT_EQ(0, pthread_rwlock_rdlock(&arg->lock));
791 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_RELEASED, arg->progress);
792 ASSERT_EQ(0, pthread_rwlock_unlock(&arg->lock));
799 ASSERT_EQ(0, pthread_rwlock_init(&wakeup_arg.lock, NULL));
800 ASSERT_EQ(0, pthread_rwlock_wrlock(&wakeup_arg.lock));
805 ASSERT_EQ(0, pthread_create(&thread, NULL,
808 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_WAITING, wakeup_arg.progress);
811 ASSERT_EQ(0, pthread_rwlock_unlock(&wakeup_arg.lock));
813 ASSERT_EQ(0, pthread_join(thread, NULL));
814 ASSERT_EQ(RwlockWakeupHelperArg::LOCK_ACCESSED, wakeup_arg.progress);
815 ASSERT_EQ(0, pthread_rwlock_destroy(&wakeup_arg.lock));
843 ASSERT_EQ(0, pthread_create(&thread, NULL,
850 ASSERT_EQ(0, pthread_create(&thread, NULL,
857 ASSERT_EQ(0, pthread_rwlockattr_init(&attr));
858 ASSERT_EQ(0, pthread_rwlockattr_setkind_np(&attr, kind_type));
859 ASSERT_EQ(0, pthread_rwlock_init(&lock, &attr));
860 ASSERT_EQ(0, pthread_rwlockattr_destroy(&attr));
864 ASSERT_EQ(0, pthread_rwlock_destroy(&lock));
871 ASSERT_EQ(0, pthread_rwlock_wrlock(&helper->lock));
872 ASSERT_EQ(0, pthread_rwlock_unlock(&helper->lock));
880 ASSERT_EQ(0, pthread_rwlock_rdlock(&helper->lock));
881 ASSERT_EQ(0, pthread_rwlock_unlock(&helper->lock));
888 ASSERT_EQ(0, pthread_rwlock_rdlock(&helper.lock));
898 ASSERT_EQ(0, pthread_join(reader_thread, NULL));
900 ASSERT_EQ(0, pthread_rwlock_unlock(&helper.lock));
901 ASSERT_EQ(0, pthread_join(writer_thread, NULL));
906 ASSERT_EQ(0, pthread_rwlock_rdlock(&helper.lock));
918 ASSERT_EQ(0, pthread_rwlock_unlock(&helper.lock));
919 ASSERT_EQ(0, pthread_join(writer_thread, NULL));
920 ASSERT_EQ(0, pthread_join(reader_thread, NULL));
930 ASSERT_EQ(0, pthread_once(&once_control, OnceFn));
931 ASSERT_EQ(0, pthread_once(&once_control, OnceFn));
932 ASSERT_EQ(1, g_once_fn_call_count);
951 ASSERT_EQ(0, pthread_once(&once_control_1, &Routine1));
952 ASSERT_EQ("12", pthread_once_1934122_result);
966 ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1));
967 ASSERT_EQ(0, pthread_atfork(AtForkPrepare2, AtForkParent2, AtForkChild2));
974 ASSERT_EQ(12, g_atfork_child_calls);
977 ASSERT_EQ(12, g_atfork_parent_calls);
980 ASSERT_EQ(21, g_atfork_prepare_calls);
982 ASSERT_EQ(pid, waitpid(pid, &status, 0));
987 ASSERT_EQ(0, pthread_attr_init(&attr));
990 ASSERT_EQ(0, pthread_attr_getscope(&attr, &scope));
991 ASSERT_EQ(PTHREAD_SCOPE_SYSTEM, scope);
999 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock));
1000 ASSERT_EQ(CLOCK_REALTIME, clock);
1003 ASSERT_EQ(0, pthread_condattr_getpshared(&attr, &pshared));
1004 ASSERT_EQ(PTHREAD_PROCESS_PRIVATE, pshared);
1011 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_REALTIME));
1013 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock));
1014 ASSERT_EQ(CLOCK_REALTIME, clock);
1016 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_MONOTONIC));
1017 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock));
1018 ASSERT_EQ(CLOCK_MONOTONIC, clock);
1020 ASSERT_EQ(EINVAL, pthread_condattr_setclock(&attr, CLOCK_PROCESS_CPUTIME_ID));
1028 ASSERT_EQ(0, pthread_condattr_setclock(&attr, CLOCK_MONOTONIC));
1029 ASSERT_EQ(0, pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED));
1032 ASSERT_EQ(0, pthread_cond_init(&cond_var, &attr));
1034 ASSERT_EQ(0, pthread_cond_signal(&cond_var));
1035 ASSERT_EQ(0, pthread_cond_broadcast(&cond_var));
1039 ASSERT_EQ(0, pthread_condattr_getclock(&attr, &clock));
1040 ASSERT_EQ
1042 ASSERT_EQ(0, pthread_condattr_getpshared(&attr, &pshared));
1043 ASSERT_EQ(PTHREAD_PROCESS_SHARED, pshared);
1065 ASSERT_EQ(0, pthread_mutex_init(&mutex, NULL));
1066 ASSERT_EQ(0, pthread_cond_init(&cond, NULL));
1068 ASSERT_EQ(0,
1073 ASSERT_EQ(0, pthread_join(thread, NULL));
1074 ASSERT_EQ(FINISHED, progress);
1075 ASSERT_EQ(0, pthread_cond_destroy(&cond));
1076 ASSERT_EQ(0, pthread_mutex_destroy(&mutex));
1088 ASSERT_EQ(0, pthread_mutex_lock(&test->mutex));
1091 ASSERT_EQ(0, pthread_cond_wait(&test->cond, &test->mutex));
1093 ASSERT_EQ(SIGNALED, test->progress);
1095 ASSERT_EQ(0, pthread_mutex_unlock(&test->mutex));
1113 ASSERT_EQ(0, pthread_mutex_init(&m, NULL));
1116 ASSERT_EQ(0, pthread_mutex_lock(&m));
1119 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts));
1121 ASSERT_EQ(ETIMEDOUT, pthread_mutex_timedlock(&m, &ts));
1124 ASSERT_EQ(0, pthread_mutex_unlock(&m));
1126 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts));
1128 ASSERT_EQ(0, pthread_mutex_timedlock(&m, &ts));
1130 ASSERT_EQ(0, pthread_mutex_unlock(&m));
1131 ASSERT_EQ(0, pthread_mutex_destroy(&m));
1136 ASSERT_EQ(getpid(), syscall(__NR_gettid));
1140 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attributes));
1144 ASSERT_EQ(0, pthread_attr_getguardsize(&attributes, &guard_size));
1145 ASSERT_EQ(0U, guard_size); // The main thread has no guard page.
1150 ASSERT_EQ(0, pthread_attr_getstack(&attributes, &stack_base, &stack_size));
1152 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size2));
1175 ASSERT_EQ(0, getrlimit(RLIMIT_STACK, &rl));
1186 ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
1199 ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
1201 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attributes));
1202 ASSERT_EQ(0, pthread_attr_getstack(&attributes, &stack_base, &stack_size));
1203 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size2));
1206 ASSERT_EQ(1024U, stack_size);
1213 ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
1215 ASSERT_EQ(0, pthread_getattr_np(pthread_self(), &attributes));
1216 ASSERT_EQ(0, pthread_attr_getstack(&attributes, &stack_base, &stack_size));
1217 ASSERT_EQ(0, pthread_attr_getstacksize(&attributes, &stack_size2));
1220 ASSERT_EQ(6666U, stack_size);
1240 ASSERT_EQ(0, pthread_create(&t, NULL,
1255 ASSERT_EQ(gettid(), pthread_gettid_np(pthread_self()));
1265 ASSERT_EQ(t_gettid_result, t_pthread_gettid_np_result);
1288 ASSERT_EQ(1U, cleanup_counter);
1303 ASSERT_EQ(0, pthread_create(&t, NULL, PthreadCleanupStartRoutine, NULL));
1305 ASSERT_EQ(2U, cleanup_counter);
1309 ASSERT_EQ(PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_DEFAULT);
1314 ASSERT_EQ(0, pthread_mutexattr_init(&attr));
1318 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL));
1319 ASSERT_EQ(0, pthread_mutexattr_gettype(&attr, &attr_type));
1320 ASSERT_EQ(PTHREAD_MUTEX_NORMAL, attr_type);
1322 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK));
1323 ASSERT_EQ(0, pthread_mutexattr_gettype(&attr, &attr_type));
1324 ASSERT_EQ(PTHREAD_MUTEX_ERRORCHECK, attr_type);
1326 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE));
1327 ASSERT_EQ(0, pthread_mutexattr_gettype(&attr, &attr_type));
1328 ASSERT_EQ(PTHREAD_MUTEX_RECURSIVE, attr_type);
1330 ASSERT_EQ(0, pthread_mutexattr_destroy(&attr));
1347 ASSERT_EQ(0, pthread_mutexattr_init(&attr));
1348 ASSERT_EQ(0, pthread_mutexattr_settype(&attr, mutex_type));
1349 ASSERT_EQ(0, pthread_mutex_init(&lock, &attr));
1350 ASSERT_EQ(0, pthread_mutexattr_destroy(&attr));
1354 ASSERT_EQ(0, pthread_mutex_destroy(&lock));
1363 ASSERT_EQ(0, pthread_mutex_lock(&m.lock));
1364 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1370 ASSERT_EQ(0, pthread_mutex_lock(&m.lock));
1371 ASSERT_EQ(EDEADLK, pthread_mutex_lock(&m.lock));
1372 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1373 ASSERT_EQ(0, pthread_mutex_trylock(&m.lock));
1374 ASSERT_EQ(EBUSY, pthread_mutex_trylock(&m.lock));
1375 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1376 ASSERT_EQ(EPERM, pthread_mutex_unlock(&m.lock));
1382 ASSERT_EQ(0, pthread_mutex_lock(&m.lock));
1383 ASSERT_EQ(0, pthread_mutex_lock(&m.lock));
1384 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1385 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1386 ASSERT_EQ(0, pthread_mutex_trylock(&m.lock));
1387 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1388 ASSERT_EQ(EPERM, pthread_mutex_unlock(&m.lock));
1394 ASSERT_EQ(0, memcmp(&lock_normal, &m1.lock, sizeof(pthread_mutex_t)));
1399 ASSERT_EQ(0, memcmp(&lock_errorcheck, &m2.lock, sizeof(pthread_mutex_t)));
1404 ASSERT_EQ(0, memcmp(&lock_recursive, &m3.lock, sizeof(pthread_mutex_t)));
1405 ASSERT_EQ(0, pthread_mutex_destroy(&lock_recursive));
1421 ASSERT_EQ(LOCK_INITIALIZED, helper->progress);
1424 ASSERT_EQ(0, pthread_mutex_lock(&helper->m.lock));
1425 ASSERT_EQ(LOCK_RELEASED, helper->progress);
1426 ASSERT_EQ(0, pthread_mutex_unlock(&helper->m.lock));
1436 ASSERT_EQ(0, pthread_mutex_lock(&m.lock));
1441 ASSERT_EQ(0, pthread_create(&thread, NULL,
1445 ASSERT_EQ(LOCK_WAITING, progress);
1448 ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
1450 ASSERT_EQ(0, pthread_join(thread, NULL));
1451 ASSERT_EQ(LOCK_ACCESSED, progress);
1475 ASSERT_EQ(1, fscanf(fp, "%ld", &pid_max));
1515 ASSERT_EQ(0, pthread_mutex_init(mutex, NULL));
1516 ASSERT_EQ(0, pthread_mutex_lock(mutex));
1517 ASSERT_EQ(0, pthread_mutex_unlock(mutex));
1518 ASSERT_EQ(0, pthread_mutex_destroy(mutex));
1522 ASSERT_EQ(0, pthread_cond_init(cond, NULL));
1523 ASSERT_EQ(0, pthread_cond_signal(cond));
1524 ASSERT_EQ(0, pthread_cond_broadcast(cond));
1525 ASSERT_EQ(0, pthread_cond_destroy(cond));
1529 ASSERT_EQ(0, pthread_rwlock_init(rwlock, NULL));
1530 ASSERT_EQ(0, pthread_rwlock_rdlock(rwlock));
1531 ASSERT_EQ(0, pthread_rwlock_unlock(rwlock));
1532 ASSERT_EQ(0, pthread_rwlock_wrlock(rwlock));
1533 ASSERT_EQ(0, pthread_rwlock_unlock(rwlock));
1534 ASSERT_EQ(0, pthread_rwlock_destroy(rwlock));
1543 ASSERT_EQ(EINVAL, pthread_mutex_lock(NULL));
1551 ASSERT_EQ(EINVAL, pthread_mutex_unlock(NULL));