Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.4 KiB

  1. //===-- llvm/Support/Threading.h - Control multithreading mode --*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // TThis file defines llvm_start_multithreaded() and friends.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_SUPPORT_THREADING_H
  14. #define LLVM_SUPPORT_THREADING_H
  15. namespace llvm {
  16. /// llvm_start_multithreaded - Allocate and initialize structures needed to
  17. /// make LLVM safe for multithreading. The return value indicates whether
  18. /// multithreaded initialization succeeded. LLVM will still be operational
  19. /// on "failed" return, and will still be safe for hosting threading
  20. /// applications in the JIT, but will not be safe for concurrent calls to the
  21. /// LLVM APIs.
  22. /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.
  23. bool llvm_start_multithreaded();
  24. /// llvm_stop_multithreaded - Deallocate structures necessary to make LLVM
  25. /// safe for multithreading.
  26. /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.
  27. void llvm_stop_multithreaded();
  28. /// llvm_is_multithreaded - Check whether LLVM is executing in thread-safe
  29. /// mode or not.
  30. bool llvm_is_multithreaded();
  31. /// acquire_global_lock - Acquire the global lock. This is a no-op if called
  32. /// before llvm_start_multithreaded().
  33. void llvm_acquire_global_lock();
  34. /// release_global_lock - Release the global lock. This is a no-op if called
  35. /// before llvm_start_multithreaded().
  36. void llvm_release_global_lock();
  37. /// llvm_execute_on_thread - Execute the given \p UserFn on a separate
  38. /// thread, passing it the provided \p UserData.
  39. ///
  40. /// This function does not guarantee that the code will actually be executed
  41. /// on a separate thread or honoring the requested stack size, but tries to do
  42. /// so where system support is available.
  43. ///
  44. /// \param UserFn - The callback to execute.
  45. /// \param UserData - An argument to pass to the callback function.
  46. /// \param RequestedStackSize - If non-zero, a requested size (in bytes) for
  47. /// the thread stack.
  48. void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData,
  49. unsigned RequestedStackSize = 0);
  50. }
  51. #endif