c5f91c5c7c826432bca3ad41280cd99362c51806
[libcds.git] / cds / os / posix / fake_topology.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_OS_POSIX_FAKE_TOPOLOGY_H
4 #define __CDS_OS_POSIX_FAKE_TOPOLOGY_H
5
6 #ifndef __CDS_OS_TOPOLOGY_H
7 #   error "<cds/os/topology.h> must be included instead"
8 #endif
9
10 #include <cds/os/details/fake_topology.h>
11 #include <unistd.h>
12
13 namespace cds { namespace OS {
14     namespace posix {
15         /// Fake system topology
16         struct topology {
17             /// Logical processor count for the system. Always returns 1
18             static unsigned int processor_count()
19             {
20                 return 1;
21             }
22
23             /// Get current processor number
24             /**
25                 Always returns 0
26             */
27             static unsigned int current_processor()
28             {
29                 return 0;
30             }
31
32             /// Synonym for \ref current_processor
33             static unsigned int native_current_processor()
34             {
35                 return current_processor();
36             }
37
38             //@cond
39             static void init()
40             {}
41             static void fini()
42             {}
43             //@endcond
44         };
45     }   // namespace posix
46
47     using posix::topology;
48 }}  // namespace cds::OS
49
50 #endif  // #ifndef __CDS_OS_POSIX_FAKE_TOPOLOGY_H