Skip to content

Commit 29977ad

Browse files
Add support for C++ modules
1 parent ca55244 commit 29977ad

3 files changed

Lines changed: 140 additions & 8 deletions

File tree

include/tmc/topology.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include <cstddef>
1111
#include <vector>
1212

13-
namespace tmc {
14-
namespace topology {
13+
namespace tmc::topology {
1514
/// CPU kind types for hybrid architectures (P-cores vs E-cores).
1615
/// cpu_kind is a flags bitmap; you can OR together multiple flags to combine
1716
/// them in a filter.
@@ -237,8 +236,7 @@ void pin_thread(topology_filter const& Allowed);
237236

238237
#endif
239238

240-
} // namespace topology
241-
} // namespace tmc
239+
} // namespace tmc::topology
242240

243241
#ifdef TMC_IMPL
244242
#include "tmc/detail/topology.ipp"

include/tmc/traits.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include "tmc/detail/concepts_awaitable.hpp"
99
#include "tmc/detail/concepts_work_item.hpp"
1010

11-
namespace tmc {
12-
namespace traits {
11+
namespace tmc::traits {
1312
/// If this type is returned from a type trait, it indicates that the type trait
1413
/// doesn't apply to whatever you're inspecting. For example, `unknown_t` will
1514
/// be returned from `awaitable_result_t` if the provided type is not an
@@ -129,5 +128,4 @@ concept is_func_nonvoid = tmc::detail::is_func_nonvoid<T>;
129128
template <typename T, typename Result>
130129
concept is_func_result = tmc::detail::is_func_result<T, Result>;
131130

132-
} // namespace traits
133-
} // namespace tmc
131+
} // namespace tmc::traits

modules/tmc.cppm

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Copyright (c) 2023-2026 Logan McDougall
2+
//
3+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include <tmc/all_headers.hpp>
7+
8+
export namespace tmc {
9+
using tmc::aw_atomic_condvar;
10+
using tmc::aw_atomic_condvar_co_notify;
11+
using tmc::atomic_condvar;
12+
using tmc::aw_auto_reset_event_co_set;
13+
using tmc::auto_reset_event;
14+
using tmc::aw_resume_on;
15+
using tmc::resume_on;
16+
using tmc::change_priority;
17+
using tmc::aw_ex_scope_exit;
18+
using tmc::aw_ex_scope_enter;
19+
using tmc::enter;
20+
using tmc::yield_requested;
21+
using tmc::aw_yield;
22+
using tmc::yield;
23+
using tmc::aw_yield_if_requested;
24+
using tmc::yield_if_requested;
25+
using tmc::aw_yield_counter_dynamic;
26+
using tmc::check_yield_counter_dynamic;
27+
using tmc::aw_yield_counter;
28+
using tmc::check_yield_counter;
29+
using tmc::aw_reschedule;
30+
using tmc::reschedule;
31+
using tmc::aw_barrier;
32+
using tmc::barrier;
33+
using tmc::chan_default_config;
34+
using tmc::chan_tok;
35+
using tmc::chan_err;
36+
using tmc::make_channel;
37+
using tmc::channel;
38+
using tmc::chan_zc_scope;
39+
using tmc::chan_zc_scope;
40+
using tmc::current_priority;
41+
using tmc::current_executor;
42+
using tmc::current_thread_index;
43+
using tmc::ex_any;
44+
using tmc::ex_braid;
45+
using tmc::ex_cpu_st;
46+
using tmc::ex_cpu;
47+
using tmc::cpu_executorl
48+
using tmc::async_main;
49+
using tmc::ex_manual_st;
50+
using tmc::set_default_executor;
51+
using tmc::aw_fork_group;
52+
using tmc::fork_group;
53+
using tmc::latch;
54+
using tmc::manual_reset_event;
55+
using tmc::aw_manual_reset_event;
56+
using tmc::aw_manual_reset_event_co_set;
57+
using tmc::mutex;
58+
using tmc::mutex_scope;
59+
using tmc::aw_mutex_lock_scope;
60+
using tmc::aw_mutex_co_unlock;
61+
using tmc::semaphore;
62+
using tmc::semaphore_scope;
63+
using tmc::aw_semaphore_acquire_scope;
64+
using tmc::aw_semaphore_co_release;
65+
using tmc::aw_acquire;
66+
using tmc::aw_spawn_func;
67+
using tmc::aw_spawn_func_impl;
68+
using tmc::aw_spawn_func_fork_impl;
69+
using tmc::spawn_func;
70+
using tmc::aw_spawn_group;
71+
using tmc::spawn_group;
72+
using tmc::aw_spawn_many;
73+
using tmc::spawn_many;
74+
using tmc::aw_spawn_many_impl;
75+
using tmc::aw_spawn_tuple;
76+
using tmc::aw_spawn_tuple_impl;
77+
using tmc::aw_spawn_tuple_fork;
78+
using tmc::aw_spawn_tuple_each;
79+
using tmc::spawn_tuple;
80+
using tmc::aw_fork_tuple_clang;
81+
using tmc::fork_tuple_clang;
82+
using tmc::aw_spawn;
83+
using tmc::aw_spawn_fork_impl;
84+
using tmc::spawn;
85+
using tmc::aw_fork_clang;
86+
using tmc::fork_clang;
87+
using tmc::post;
88+
using tmc::post_waitable;
89+
using tmc::post_bulk_waitable;
90+
using tmc::post_bulk;
91+
using tmc::aw_task;
92+
using tmc::task;
93+
using tmc::iter_adapter;
94+
using tmc::work_item;
95+
96+
namespace topology {
97+
using tmc::topology::cpu_kind;
98+
using tmc::topology::thread_pinning_level;
99+
using tmc::topology::thread_packing_strategy;
100+
using tmc::topology::core_group;
101+
using tmc::topology::thread_info;
102+
103+
#ifdef TMC_USE_HWLOC
104+
using tmc::topology::cpu_topology;
105+
using tmc::topology::topology_filter;
106+
using tmc::topology::pin_thread;
107+
#endif
108+
}
109+
110+
namespace traits {
111+
using tmc::traits::unknown_t;
112+
using tmc::traits::is_awaitable;
113+
using tmc::traits::awaitable_result_t;
114+
using tmc::traits::is_callable;
115+
using tmc::traits::callable_result_t;
116+
using tmc::traits::executable_kind;
117+
using tmc::traits::executable_kind_v;
118+
using tmc::traits::executable_result_t;
119+
using tmc::traits::executable_traits;
120+
using tmc::traits::is_task;
121+
using tmc::traits::is_task_void;
122+
using tmc::traits::is_task_nonvoid;
123+
using tmc::traits::is_task_result;
124+
using tmc::traits::is_func;
125+
using tmc::traits::is_func_void;
126+
using tmc::traits::is_func_nonvoid;
127+
using tmc::traits::is_func_result;
128+
}
129+
130+
#ifdef TMC_DEBUG_TASK_ALLOC_COUNT
131+
namespace debug {
132+
using tmc::debug::get_task_alloc_count;
133+
using tmc::debug::set_task_alloc_count;
134+
}
135+
#endif
136+
}

0 commit comments

Comments
 (0)