1 //===-- Support/ThreadSupport.h - Generic threading support -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines platform-agnostic interfaces that can be used to write
11 // multi-threaded programs. Autoconf is used to chose the correct
12 // implementation of these interfaces, or default to a non-thread-capable system
13 // if no matching system support is available.
15 //===----------------------------------------------------------------------===//
17 #ifndef SUPPORT_THREADSUPPORT_H
18 #define SUPPORT_THREADSUPPORT_H
20 #if @HAVE_PTHREAD_MUTEX_LOCK@
21 #include "Support/ThreadSupport-PThreads.h"
23 #include "Support/ThreadSupport-NoSupport.h"
24 #endif // If no system support is available
27 /// MutexLocker - Instances of this class acquire a given Lock when
28 /// constructed and hold that lock until destruction.
32 MutexLocker(const MutexLocker &); // DO NOT IMPLEMENT
33 void operator=(const MutexLocker &); // DO NOT IMPLEMENT
35 MutexLocker(Mutex &m) : M(m) { M.acquire(); }
36 ~MutexLocker() { M.release(); }
40 #endif // SUPPORT_THREADSUPPORT_H