Thread.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/concurrency/Thread.hpp"

setThreadAffinityToOneCpu

Namespace: oatpp::concurrency

Set thread affinity to one CPU.

  • @param nativeHandle - std::thread::native_handle_type.
  • @param cpuIndex - index of CPU.
  • @return - zero on success. Negative value on failure. -1 if platform that runs application does not support this call.

v_int32 setThreadAffinityToOneCpu(std::thread::native_handle_type nativeHandle, v_int32 cpuIndex)

setThreadAffinityToCpuRange

Namespace: oatpp::concurrency

Set thread affinity [firstCpuIndex..lastCpuIndex].

  • @param nativeHandle - std::thread::native_handle_type.
  • @param firstCpuIndex - from CPU-index.
  • @param lastCpuIndex - to CPU-index included.
  • @return - zero on success. Negative value on failure. -1 if platform that runs application does not support this call.

v_int32 setThreadAffinityToCpuRange(std::thread::native_handle_type nativeHandle, v_int32 firstCpuIndex, v_int32 lastCpuIndex)

getHardwareConcurrency

Namespace: oatpp::concurrency

Get hardware concurrency.

  • @return - OATPP_THREAD_HARDWARE_CONCURRENCY config value if set
    else return std::thread::hardware_concurrency()
    else return 1.

v_int32 getHardwareConcurrency()