diff options
| -rw-r--r-- | zen/cmds/hash.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/zen/cmds/hash.cpp b/zen/cmds/hash.cpp index d9d137f61..a676221e1 100644 --- a/zen/cmds/hash.cpp +++ b/zen/cmds/hash.cpp @@ -13,6 +13,49 @@ namespace zen { +//////////////////////////////////////////////////////////////////////////////// + +#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC + +namespace Concurrency +{ + +template <typename IterType, typename LambdaType> void +parallel_for_each(IterType Cursor, IterType End, const LambdaType& Lambda) +{ + for (; Cursor < End; ++Cursor) + { + Lambda(*Cursor); + } +} + +template <typename T> +struct combinable +{ + combinable<T>& local() + { + return *this; + } + + void operator += (T Rhs) + { + Value += Rhs; + } + + template <typename LambdaType> void combine_each(const LambdaType& Lambda) + { + Lambda(Value); + } + + T Value = 0; +}; + +} // namespace Concurrency + +#endif // ZEN_PLATFORM_LINUX|MAC + +//////////////////////////////////////////////////////////////////////////////// + HashCommand::HashCommand() { m_Options.add_options()("d,dir", "Directory to scan", cxxopts::value<std::string>(m_ScanDirectory))( |