LLVM API Documentation

Threading.h
Go to the documentation of this file.
00001 //===-- llvm/Support/Threading.h - Control multithreading mode --*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares helper functions for running LLVM in a multi-threaded
00011 // environment.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_SUPPORT_THREADING_H
00016 #define LLVM_SUPPORT_THREADING_H
00017 
00018 namespace llvm {
00019   /// Returns true if LLVM is compiled with support for multi-threading, and
00020   /// false otherwise.
00021   bool llvm_is_multithreaded();
00022 
00023   /// llvm_execute_on_thread - Execute the given \p UserFn on a separate
00024   /// thread, passing it the provided \p UserData and waits for thread 
00025   /// completion.
00026   ///
00027   /// This function does not guarantee that the code will actually be executed
00028   /// on a separate thread or honoring the requested stack size, but tries to do
00029   /// so where system support is available.
00030   ///
00031   /// \param UserFn - The callback to execute.
00032   /// \param UserData - An argument to pass to the callback function.
00033   /// \param RequestedStackSize - If non-zero, a requested size (in bytes) for
00034   /// the thread stack.
00035   void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData,
00036                               unsigned RequestedStackSize = 0);
00037 }
00038 
00039 #endif