LLVM API Documentation
00001 /* include/llvm/Support/ThreadSupport.h. Generated by configure. */ 00002 //===-- Support/ThreadSupport.h - Generic threading support -----*- C++ -*-===// 00003 // 00004 // The LLVM Compiler Infrastructure 00005 // 00006 // This file was developed by the LLVM research group and is distributed under 00007 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00008 // 00009 //===----------------------------------------------------------------------===// 00010 // 00011 // This file defines platform-agnostic interfaces that can be used to write 00012 // multi-threaded programs. Autoconf is used to chose the correct 00013 // implementation of these interfaces, or default to a non-thread-capable system 00014 // if no matching system support is available. 00015 // 00016 //===----------------------------------------------------------------------===// 00017 00018 #ifndef SUPPORT_THREADSUPPORT_H 00019 #define SUPPORT_THREADSUPPORT_H 00020 00021 #define HAVE_PTHREAD_MUTEX_LOCK 1 00022 00023 #ifdef HAVE_PTHREAD_MUTEX_LOCK 00024 #include "llvm/Support/ThreadSupport-PThreads.h" 00025 #else 00026 #include "llvm/Support/ThreadSupport-NoSupport.h" 00027 #endif // If no system support is available 00028 00029 namespace llvm { 00030 /// MutexLocker - Instances of this class acquire a given Lock when 00031 /// constructed and hold that lock until destruction. 00032 /// 00033 class MutexLocker { 00034 Mutex &M; 00035 MutexLocker(const MutexLocker &); // DO NOT IMPLEMENT 00036 void operator=(const MutexLocker &); // DO NOT IMPLEMENT 00037 public: 00038 MutexLocker(Mutex &m) : M(m) { M.acquire(); } 00039 ~MutexLocker() { M.release(); } 00040 }; 00041 } 00042 00043 #endif // SUPPORT_THREADSUPPORT_H