RDKit
Open-source cheminformatics and machine learning.
RDThreads.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2015 Greg Landrum
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 
11 #ifndef RDTHREADS_H_2015
12 #define RDTHREADS_H_2015
13 
14 #include <RDGeneral/Invariant.h>
15 
16 #ifdef RDK_THREADSAFE_SSS
18 #include <boost/thread.hpp>
20 
21 namespace RDKit {
22 inline unsigned int getNumThreadsToUse(int target) {
23  if (target >= 1) {
24  return static_cast<unsigned int>(target);
25  }
26  unsigned int res = boost::thread::hardware_concurrency();
27  if (res > rdcast<unsigned int>(-target)) {
28  return res + target;
29  } else {
30  return 1;
31  }
32 }
33 }
34 
35 #else
36 
37 namespace RDKit {
38 inline unsigned int getNumThreadsToUse(int target) {
39  RDUNUSED_PARAM(target);
40  return 1;
41 }
42 }
43 #endif
44 
45 #endif
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
unsigned int getNumThreadsToUse(int target)
Definition: RDThreads.h:38
#define RDUNUSED_PARAM(x)
Definition: Invariant.h:194