Skip to content

Instantly share code, notes, and snippets.

@turtlesoupy
Created May 30, 2020 02:41
Show Gist options
  • Save turtlesoupy/03f383e890875b15fe51971fe5df8e3d to your computer and use it in GitHub Desktop.
Save turtlesoupy/03f383e890875b15fe51971fe5df8e3d to your computer and use it in GitHub Desktop.
#pragma once
#include <string>
#include <thread>
namespace skimpy {
class GlobalConfig {
public:
static inline GlobalConfig& get() {
static GlobalConfig instance;
return instance;
}
int getParallelizeThreshold() {
return parallelizeThreshold_;
}
void setParallelizeThreshold(int threshold) {
parallelizeThreshold_ = threshold;
}
int getParallelizeParts() {
return parallelizeParts_;
}
void setParallelizeParts(int parts) {
parallelizeParts_ = parts;
}
private:
GlobalConfig()
: parallelizeThreshold_(8 * 1024),
parallelizeParts_(std::thread::hardware_concurrency()){
};
int parallelizeThreshold_;
int parallelizeParts_;
};
} // namespace skimpy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment