mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
For PR616:
These patches make threading optional in LLVM. The configuration scripts are now modified to accept a --disable-threads switch. If this is used, the Mutex class will be implemented with all functions as no-op. Furthermore, linking against libpthread will not be done. Finally, the ParallelJIT example needs libpthread so its makefile was changed to always add -lpthread to the link line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -11,23 +11,36 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/System/Mutex.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/System/Mutex.h"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_MUTEX_LOCK)
|
||||
|
||||
#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0
|
||||
// Define all methods as no-ops if threading is explicitly disabled
|
||||
namespace llvm {
|
||||
using namespace sys;
|
||||
Mutex::Mutex( bool recursive) { }
|
||||
Mutex::~Mutex() { }
|
||||
bool Mutex::acquire() { return true; }
|
||||
bool Mutex::release() { return true; }
|
||||
bool Mutex::tryacquire() { return true; }
|
||||
}
|
||||
#else
|
||||
|
||||
#if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_MUTEX_LOCK)
|
||||
|
||||
#include <cassert>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace llvm {
|
||||
using namespace sys;
|
||||
|
||||
|
||||
// This variable is useful for situations where the pthread library has been
|
||||
// compiled with weak linkage for its interface symbols. This allows the
|
||||
// threading support to be turned off by simply not linking against -lpthread.
|
||||
@@ -143,3 +156,4 @@ Mutex::tryacquire()
|
||||
#else
|
||||
#warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in System/Mutex.cpp
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user