brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · d77d162 Raw
35 lines · c
1//===-- PThreadCondition.h --------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9//  Created by Greg Clayton on 6/16/07.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_PTHREADCONDITION_H14#define LLDB_TOOLS_DEBUGSERVER_SOURCE_PTHREADCONDITION_H15 16#include <pthread.h>17 18class PThreadCondition {19public:20  PThreadCondition() { ::pthread_cond_init(&m_condition, NULL); }21 22  ~PThreadCondition() { ::pthread_cond_destroy(&m_condition); }23 24  pthread_cond_t *Condition() { return &m_condition; }25 26  int Broadcast() { return ::pthread_cond_broadcast(&m_condition); }27 28  int Signal() { return ::pthread_cond_signal(&m_condition); }29 30protected:31  pthread_cond_t m_condition;32};33 34#endif35