//===- PerThreadBumpPtrAllocator.h ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_PERTHREADBUMPPTRALLOCATOR_H #define LLVM_SUPPORT_PERTHREADBUMPPTRALLOCATOR_H #include "llvm/Support/Allocator.h" #include "llvm/Support/Parallel.h" namespace llvm { namespace parallel { /// PerThreadAllocator is used in conjunction with ThreadPoolExecutor to allow /// per-thread allocations. It wraps a possibly thread-unsafe allocator, /// e.g. BumpPtrAllocator. PerThreadAllocator must be used with only main thread /// or threads created by ThreadPoolExecutor, as it utilizes getThreadIndex, /// which is set by ThreadPoolExecutor. To work properly, ThreadPoolExecutor /// should be initialized before PerThreadAllocator is created. /// TODO: The same approach might be implemented for ThreadPool. template <typename AllocatorTy> class PerThreadAllocator : public AllocatorBase<PerThreadAllocator<AllocatorTy>> { … }; PerThreadBumpPtrAllocator; } // end namespace parallel } // end namespace llvm #endif // LLVM_SUPPORT_PERTHREADBUMPPTRALLOCATOR_H