]> git.saurik.com Git - apple/libpthread.git/blame - tests/pthread_get_qos_class_np.c
libpthread-454.100.8.tar.gz
[apple/libpthread.git] / tests / pthread_get_qos_class_np.c
CommitLineData
a0619f9c
A
1#include <assert.h>
2#include <stdio.h>
3#include <unistd.h>
4#include <stdbool.h>
5
6#include <sys/qos.h>
7#include <sys/resource.h>
8#include <pthread.h>
9
10#include "darwintest_defaults.h"
11
12static void *sleep_thread(void __unused *arg){
13 sleep(1);
14 return NULL;
15}
16
17/* Regression test for <rdar://problem/29209770> */
18T_DECL(test_pthread_get_qos_class_np, "Test for pthread_get_qos_class_np()", T_META_CHECK_LEAKS(NO)) {
19 pthread_t thread;
20 pthread_attr_t attr;
21 pthread_attr_init(&attr);
22 pthread_attr_set_qos_class_np(&attr, QOS_CLASS_BACKGROUND, 0);
23 pthread_create(&thread, &attr, sleep_thread, NULL);
24
25 qos_class_t qos;
26 pthread_get_qos_class_np(thread, &qos, NULL);
27
28 T_EXPECT_EQ(qos, (qos_class_t)QOS_CLASS_BACKGROUND, NULL);
29}