Sha256: 882d7d7824e24717ff3b35965deb1f9141b474aa8a52904a61a993524470a9d1
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
// Copyright (C) 2016 Davis E. King (davis@dlib.net) // License: Boost Software License See LICENSE.txt for the full license. #ifndef DLIB_AsYNC_CPP_ #define DLIB_AsYNC_CPP_ // C++11 things don't work in old versions of visual studio #if !defined( _MSC_VER) || _MSC_VER >= 1900 #include "async.h" #include <stdlib.h> #include "../string.h" #include <thread> namespace dlib { // ---------------------------------------------------------------------------------------- namespace impl { unsigned long default_num_threads() { try { char* nt = getenv("DLIB_NUM_THREADS"); if (nt) return string_cast<unsigned long>(nt); } catch(string_cast_error&) {} return std::thread::hardware_concurrency(); } } // ---------------------------------------------------------------------------------------- thread_pool& default_thread_pool() { static thread_pool tp(impl::default_num_threads()); return tp; } } // ---------------------------------------------------------------------------------------- #endif #endif // DLIB_AsYNC_CPP_
Version data entries
9 entries across 9 versions & 1 rubygems