aboutsummaryrefslogtreecommitdiff
path: root/libc/test/integration/src/pthread/pthread_join_test.cpp
blob: 6dea99de1a64fa37705df88c1e6fd65910b2aa2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===-- Tests for pthread_join-- ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/pthread/pthread_create.h"
#include "src/pthread/pthread_join.h"

#include "test/IntegrationTest/test.h"

#include <errno.h>
#include <pthread.h>

static void *simpleFunc(void *) { return nullptr; }
static void nullJoinTest() {
  pthread_t Tid;
  ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&Tid, nullptr, simpleFunc, nullptr),
            0);
  ASSERT_ERRNO_SUCCESS();
  ASSERT_EQ(LIBC_NAMESPACE::pthread_join(Tid, nullptr), 0);
  ASSERT_ERRNO_SUCCESS();
}

TEST_MAIN() {
  errno = 0;
  nullJoinTest();
  return 0;
}