File: pthread_common.hpp

package info (click to toggle)
libpmemobj-cpp 1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,388 kB
  • sloc: cpp: 136,076; sh: 1,022; perl: 381; ansic: 163; makefile: 13
file content (24 lines) | stat: -rw-r--r-- 567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2018, Intel Corporation */
#ifndef PTHREAD_COMMON_HPP
#define PTHREAD_COMMON_HPP

#include "unittest.hpp"
#include <pthread.h>

void
ut_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
		  void *(*start_routine)(void *), void *arg)
{
	if (pthread_create(thread, attr, start_routine, arg) != 0)
		UT_FATAL("pthread_create failed");
}

void
ut_pthread_join(pthread_t *thread, void **value)
{
	if (pthread_join(*thread, value) != 0)
		UT_FATAL("pthread_join failed");
}

#endif /* PTHREAD_COMMON_HPP */