Move libcds 1.6.0 from SVN
[libcds.git] / cds / os / details / fake_topology.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_OS_DETAILS_FAKE_TOPOLOGY_H
4 #define __CDS_OS_DETAILS_FAKE_TOPOLOGY_H
5
6 #include <cds/details/defs.h>
7 #include <cds/threading/model.h>
8
9 //@cond
10 namespace cds { namespace OS { namespace details {
11
12     /// Fake system topology
13     struct fake_topology {
14         /// Logical processor count for the system
15         static unsigned int processor_count()
16         {
17             return 1;
18         }
19
20         /// Get current processor number
21         /**
22             The function emulates "current processor number" using thread-specific data.
23         */
24         static unsigned int current_processor()
25         {
26             // Use fake "current processor number" assigned for current thread
27             return (unsigned int) threading::Manager::fake_current_processor();
28         }
29
30         /// Synonym for \ref current_processor
31         static unsigned int native_current_processor()
32         {
33             return current_processor();
34         }
35     };
36 }}}  // namespace cds::OS::details
37 //@endcond
38
39 #endif  // #ifndef __CDS_OS_DETAILS_FAKE_TOPOLOGY_H