Line | % of fetches | Source |
---|---|---|
1 | //////////////////////////////////////////////////////////////////////////////// | |
2 | // Copyright (c) 2011 Bryce Adelstein-Lelbach | |
3 | // Copyright (c) 2007-2016 Hartmut Kaiser | |
4 | // | |
5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | //////////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #if !defined(HPX_A55506A4_4AC7_4FD0_AB0D_ED0D1368FCC5) | |
10 | #define HPX_A55506A4_4AC7_4FD0_AB0D_ED0D1368FCC5 | |
11 | ||
12 | #include <hpx/config.hpp> | |
13 | ||
14 | #include <hpx/exception_fwd.hpp> | |
15 | #include <hpx/lcos_fwd.hpp> | |
16 | #include <hpx/runtime/components/component_type.hpp> | |
17 | #include <hpx/runtime/components_fwd.hpp> | |
18 | #include <hpx/runtime/launch_policy.hpp> | |
19 | #include <hpx/runtime/naming/name.hpp> | |
20 | #include <hpx/util/unique_function.hpp> | |
21 | ||
22 | #include <boost/dynamic_bitset.hpp> | |
23 | ||
24 | #include <cstddef> | |
25 | #include <cstdint> | |
26 | #include <string> | |
27 | #include <utility> | |
28 | #include <vector> | |
29 | ||
30 | namespace hpx { namespace agas | |
31 | { | |
32 | ||
33 | /////////////////////////////////////////////////////////////////////////////// | |
34 | HPX_API_EXPORT bool is_console(); | |
35 | ||
36 | /////////////////////////////////////////////////////////////////////////////// | |
37 | HPX_API_EXPORT bool register_name( | |
38 | launch::sync_policy | |
39 | , std::string const& name | |
40 | , naming::gid_type const& gid | |
41 | , error_code& ec = throws | |
42 | ); | |
43 | ||
44 | HPX_API_EXPORT bool register_name( | |
45 | launch::sync_policy | |
46 | , std::string const& name | |
47 | , naming::id_type const& id | |
48 | , error_code& ec = throws | |
49 | ); | |
50 | ||
51 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
52 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
53 | inline bool register_name_sync( | |
54 | std::string const& name | |
55 | , naming::gid_type const& gid | |
56 | , error_code& ec = throws | |
57 | ) | |
58 | { | |
59 | return register_name(launch::sync, name, gid, ec); | |
60 | } | |
61 | ||
62 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
63 | inline bool register_name_sync( | |
64 | std::string const& name | |
65 | , naming::id_type const& id | |
66 | , error_code& ec = throws | |
67 | ) | |
68 | { | |
69 | return register_name(launch::sync, name, id, ec); | |
70 | } | |
71 | #endif | |
72 | ||
73 | HPX_API_EXPORT lcos::future<bool> register_name( | |
74 | std::string const& name | |
75 | , naming::id_type const& id | |
76 | ); | |
77 | ||
78 | /////////////////////////////////////////////////////////////////////////////// | |
79 | HPX_API_EXPORT naming::id_type unregister_name( | |
80 | launch::sync_policy | |
81 | , std::string const& name | |
82 | , error_code& ec = throws | |
83 | ); | |
84 | ||
85 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
86 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
87 | inline bool unregister_name_sync( | |
88 | std::string const& name | |
89 | , naming::id_type& id | |
90 | , error_code& ec = throws | |
91 | ) | |
92 | { | |
93 | return unregister_name(launch::sync, name, id, ec); | |
94 | } | |
95 | ||
96 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
97 | inline naming::id_type unregister_name_sync( | |
98 | std::string const& name | |
99 | , error_code& ec = throws | |
100 | ) | |
101 | { | |
102 | return unregister_name(launch::sync, name, gid, ec); | |
103 | } | |
104 | #endif | |
105 | ||
106 | HPX_API_EXPORT lcos::future<naming::id_type> unregister_name( | |
107 | std::string const& name | |
108 | ); | |
109 | ||
110 | /////////////////////////////////////////////////////////////////////////////// | |
111 | HPX_API_EXPORT naming::id_type resolve_name( | |
112 | launch::sync_policy | |
113 | , std::string const& name | |
114 | , error_code& ec = throws | |
115 | ); | |
116 | ||
117 | HPX_API_EXPORT lcos::future<naming::id_type> resolve_name( | |
118 | std::string const& name | |
119 | ); | |
120 | ||
121 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
122 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
123 | inline bool resolve_name_sync( | |
124 | std::string const& name | |
125 | , naming::gid_type& gid | |
126 | , error_code& ec = throws | |
127 | ) | |
128 | { | |
129 | return resolve_name(launch::sync, name, gid, ec); | |
130 | } | |
131 | ||
132 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
133 | inline bool resolve_name_sync( | |
134 | std::string const& name | |
135 | , naming::id_type& id | |
136 | , error_code& ec = throws | |
137 | ) | |
138 | { | |
139 | return resolve_name(launch::sync, name, id, ec); | |
140 | } | |
141 | ||
142 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
143 | inline naming::id_type resolve_name_sync( | |
144 | std::string const& name | |
145 | , error_code& ec = throws | |
146 | ) | |
147 | { | |
148 | return resolve_name(launch::sync, name, ec); | |
149 | } | |
150 | #endif | |
151 | ||
152 | /////////////////////////////////////////////////////////////////////////////// | |
153 | // HPX_API_EXPORT lcos::future<std::vector<naming::id_type> > get_localities( | |
154 | // components::component_type type = components::component_invalid | |
155 | // ); | |
156 | // | |
157 | // HPX_API_EXPORT std::vector<naming::id_type> get_localities_sync( | |
158 | // components::component_type type | |
159 | // , error_code& ec = throws | |
160 | // ); | |
161 | // | |
162 | // inline std::vector<naming::id_type> get_localities_sync( | |
163 | // error_code& ec = throws | |
164 | // ) | |
165 | // { | |
166 | // return get_localities(components::component_invalid, ec); | |
167 | // } | |
168 | ||
169 | /////////////////////////////////////////////////////////////////////////////// | |
170 | HPX_API_EXPORT lcos::future<std::uint32_t> get_num_localities( | |
171 | components::component_type type = components::component_invalid | |
172 | ); | |
173 | ||
174 | HPX_API_EXPORT std::uint32_t get_num_localities( | |
175 | launch::sync_policy | |
176 | , components::component_type type | |
177 | , error_code& ec = throws | |
178 | ); | |
179 | ||
180 | inline std::uint32_t get_num_localities( | |
181 | launch::sync_policy | |
182 | , error_code& ec = throws | |
183 | ) | |
184 | { | |
185 | return get_num_localities(launch::sync, components::component_invalid, ec); | |
186 | } | |
187 | ||
188 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
189 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
190 | inline std::uint32_t get_num_localities_sync( | |
191 | components::component_type type | |
192 | , error_code& ec = throws | |
193 | ) | |
194 | { | |
195 | return get_num_localities(launch::sync, type, ec); | |
196 | } | |
197 | ||
198 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
199 | inline std::uint32_t get_num_localities_sync( | |
200 | error_code& ec = throws | |
201 | ) | |
202 | { | |
203 | return get_num_localities(launch::sync, components::component_invalid, ec); | |
204 | } | |
205 | #endif | |
206 | ||
207 | /////////////////////////////////////////////////////////////////////////////// | |
208 | HPX_API_EXPORT lcos::future<std::vector<std::uint32_t> > get_num_threads(); | |
209 | ||
210 | HPX_API_EXPORT std::vector<std::uint32_t> get_num_threads( | |
211 | launch::sync_policy | |
212 | , error_code& ec = throws | |
213 | ); | |
214 | ||
215 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
216 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
217 | inline std::vector<std::uint32_t> get_num_threads_sync( | |
218 | error_code& ec = throws | |
219 | ) | |
220 | { | |
221 | return get_num_threads(launch::sync, ec); | |
222 | } | |
223 | #endif | |
224 | ||
225 | /////////////////////////////////////////////////////////////////////////////// | |
226 | HPX_API_EXPORT lcos::future<std::uint32_t> get_num_overall_threads(); | |
227 | ||
228 | HPX_API_EXPORT std::uint32_t get_num_overall_threads( | |
229 | launch::sync_policy | |
230 | , error_code& ec = throws | |
231 | ); | |
232 | ||
233 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
234 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
235 | inline std::uint32_t get_num_overall_threads_sync( | |
236 | error_code& ec = throws | |
237 | ) | |
238 | { | |
239 | return get_num_overall_threads(launch::sync, ec); | |
240 | } | |
241 | #endif | |
242 | ||
243 | /////////////////////////////////////////////////////////////////////////////// | |
244 | HPX_API_EXPORT std::uint32_t get_locality_id(error_code& ec = throws); | |
245 | ||
246 | /////////////////////////////////////////////////////////////////////////////// | |
247 | HPX_API_EXPORT bool is_local_address_cached( | |
248 | naming::gid_type const& gid | |
249 | , error_code& ec = throws | |
250 | ); | |
251 | ||
252 | HPX_API_EXPORT bool is_local_address_cached( | |
253 | naming::gid_type const& gid | |
254 | , naming::address& addr | |
255 | , error_code& ec = throws | |
256 | ); | |
257 | ||
258 | inline bool is_local_address_cached( | |
259 | naming::id_type const& gid | |
260 | , error_code& ec = throws | |
261 | ) | |
262 | { | |
263 | return is_local_address_cached(gid.get_gid(), ec); | |
264 | } | |
265 | ||
266 | inline bool is_local_address_cached( | |
267 | naming::id_type const& gid | |
268 | , naming::address& addr | |
269 | , error_code& ec = throws | |
270 | ) | |
271 | { | |
272 | return is_local_address_cached(gid.get_gid(), addr, ec); | |
273 | } | |
274 | ||
275 | /////////////////////////////////////////////////////////////////////////////// | |
276 | HPX_API_EXPORT bool is_local_lva_encoded_address( | |
277 | naming::gid_type const& gid | |
278 | ); | |
279 | ||
280 | inline bool is_local_lva_encoded_address( | |
281 | naming::id_type const& gid | |
282 | ) | |
283 | { | |
284 | return is_local_lva_encoded_address(gid.get_gid()); | |
285 | } | |
286 | ||
287 | /////////////////////////////////////////////////////////////////////////////// | |
288 | HPX_API_EXPORT hpx::future<naming::address> resolve( | |
289 | naming::id_type const& id | |
290 | ); | |
291 | ||
292 | HPX_API_EXPORT naming::address resolve( | |
293 | launch::sync_policy | |
294 | , naming::id_type const& id | |
295 | , error_code& ec = throws | |
296 | ); | |
297 | ||
298 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
299 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
300 | inline naming::address resolve_sync( | |
301 | naming::id_type const& id | |
302 | , error_code& ec = throws | |
303 | ) | |
304 | { | |
305 | return resolve(launch::sync, id, ec); | |
306 | } | |
307 | #endif | |
308 | ||
309 | HPX_API_EXPORT hpx::future<bool> bind( | |
310 | naming::gid_type const& gid | |
311 | , naming::address const& addr | |
312 | , std::uint32_t locality_id | |
313 | ); | |
314 | ||
315 | HPX_API_EXPORT bool bind( | |
316 | launch::sync_policy | |
317 | , naming::gid_type const& gid | |
318 | , naming::address const& addr | |
319 | , std::uint32_t locality_id | |
320 | , error_code& ec = throws | |
321 | ); | |
322 | ||
323 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
324 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
325 | inline bool bind_sync( | |
326 | naming::gid_type const& gid | |
327 | , naming::address const& addr | |
328 | , std::uint32_t locality_id | |
329 | , error_code& ec = throws | |
330 | ) | |
331 | { | |
332 | return bind(launch::sync, gid, addr, locality_id, ec); | |
333 | } | |
334 | #endif | |
335 | ||
336 | HPX_API_EXPORT hpx::future<bool> bind( | |
337 | naming::gid_type const& gid | |
338 | , naming::address const& addr | |
339 | , naming::gid_type const& locality_ | |
340 | ); | |
341 | ||
342 | HPX_API_EXPORT bool bind( | |
343 | launch::sync_policy | |
344 | , naming::gid_type const& gid | |
345 | , naming::address const& addr | |
346 | , naming::gid_type const& locality_ | |
347 | , error_code& ec = throws | |
348 | ); | |
349 | ||
350 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
351 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
352 | inline bool bind_sync( | |
353 | naming::gid_type const& gid | |
354 | , naming::address const& addr | |
355 | , naming::gid_type const& locality_ | |
356 | , error_code& ec = throws | |
357 | ) | |
358 | { | |
359 | return bind(launch::sync, gid, addr, locality_, ec); | |
360 | } | |
361 | #endif | |
362 | ||
363 | HPX_API_EXPORT hpx::future<naming::address> unbind( | |
364 | naming::gid_type const& gid | |
365 | , std::uint64_t count = 1 | |
366 | ); | |
367 | ||
368 | HPX_API_EXPORT naming::address unbind( | |
369 | launch::sync_policy | |
370 | , naming::gid_type const& gid | |
371 | , std::uint64_t count = 1 | |
372 | , error_code& ec = throws | |
373 | ); | |
374 | ||
375 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
376 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
377 | inline naming::address unbind_sync( | |
378 | naming::gid_type const& gid | |
379 | , std::uint64_t count = 1 | |
380 | , error_code& ec = throws | |
381 | ) | |
382 | { | |
383 | return unbind(launch::sync, gid, count, ec); | |
384 | } | |
385 | #endif | |
386 | ||
387 | /////////////////////////////////////////////////////////////////////////////// | |
388 | HPX_API_EXPORT void garbage_collect_non_blocking( | |
389 | error_code& ec = throws | |
390 | ); | |
391 | ||
392 | HPX_API_EXPORT void garbage_collect( | |
393 | error_code& ec = throws | |
394 | ); | |
395 | ||
396 | /////////////////////////////////////////////////////////////////////////////// | |
397 | /// \brief Invoke an asynchronous garbage collection step on the given target | |
398 | /// locality. | |
399 | HPX_API_EXPORT void garbage_collect_non_blocking( | |
400 | naming::id_type const& id | |
401 | , error_code& ec = throws | |
402 | ); | |
403 | ||
404 | /// \brief Invoke a synchronous garbage collection step on the given target | |
405 | /// locality. | |
406 | HPX_API_EXPORT void garbage_collect( | |
407 | naming::id_type const& id | |
408 | , error_code& ec = throws | |
409 | ); | |
410 | ||
411 | /////////////////////////////////////////////////////////////////////////////// | |
412 | /// \brief Return an id_type referring to the console locality. | |
413 | HPX_API_EXPORT naming::id_type get_console_locality( | |
414 | error_code& ec = throws | |
415 | ); | |
416 | ||
417 | /////////////////////////////////////////////////////////////////////////////// | |
418 | HPX_API_EXPORT naming::gid_type get_next_id( | |
419 | std::size_t count | |
420 | , error_code& ec = throws | |
421 | ); | |
422 | ||
423 | /////////////////////////////////////////////////////////////////////////////// | |
424 | HPX_API_EXPORT void decref( | |
425 | naming::gid_type const& id | |
426 | , std::int64_t credits | |
427 | , error_code& ec = throws | |
428 | ); | |
429 | ||
430 | /////////////////////////////////////////////////////////////////////////////// | |
431 | HPX_API_EXPORT hpx::future<std::int64_t> incref( | |
432 | naming::gid_type const& gid | |
433 | , std::int64_t credits | |
434 | , naming::id_type const& keep_alive = naming::invalid_id | |
435 | ); | |
436 | ||
437 | HPX_API_EXPORT std::int64_t incref( | |
438 | launch::sync_policy | |
439 | , naming::gid_type const& gid | |
440 | , std::int64_t credits = 1 | |
441 | , naming::id_type const& keep_alive = naming::invalid_id | |
442 | , error_code& ec = throws | |
443 | ); | |
444 | ||
445 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
446 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
447 | inline hpx::future<std::int64_t> incref_async( | |
448 | naming::gid_type const& gid | |
449 | , std::int64_t credits | |
450 | , naming::id_type const& keep_alive = naming::invalid_id | |
451 | ) | |
452 | { | |
453 | return incref(gid, credits, keep_alive); | |
454 | } | |
455 | #endif | |
456 | ||
457 | /////////////////////////////////////////////////////////////////////////////// | |
458 | HPX_API_EXPORT hpx::future<naming::id_type> get_colocation_id( | |
459 | naming::id_type const& id); | |
460 | ||
461 | HPX_API_EXPORT naming::id_type get_colocation_id( | |
462 | launch::sync_policy | |
463 | , naming::id_type const& id | |
464 | , error_code& ec = throws); | |
465 | ||
466 | #if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY) | |
467 | HPX_DEPRECATED(HPX_DEPRECATED_MSG) | |
468 | inline naming::id_type get_colocation_id_sync( | |
469 | naming::id_type const& id | |
470 | , error_code& ec = throws) | |
471 | { | |
472 | return get_colocation_id(launch::sync, id, ec); | |
473 | } | |
474 | #endif | |
475 | ||
476 | /////////////////////////////////////////////////////////////////////////////// | |
477 | HPX_API_EXPORT hpx::future<hpx::id_type> on_symbol_namespace_event( | |
478 | std::string const& name, bool call_for_past_events); | |
479 | ||
480 | /////////////////////////////////////////////////////////////////////////////// | |
481 | HPX_API_EXPORT hpx::future<std::pair<naming::id_type, naming::address> > | |
482 | begin_migration(naming::id_type const& id); | |
483 | HPX_API_EXPORT hpx::future<bool> end_migration(naming::id_type const& id); | |
484 | ||
485 | HPX_API_EXPORT hpx::future<void> | |
486 | mark_as_migrated(naming::gid_type const& gid, | |
487 | util::unique_function_nonser< | |
488 | std::pair<bool, hpx::future<void> >()> && f); | |
489 | ||
490 | HPX_API_EXPORT std::pair<bool, components::pinned_ptr> | |
491 | was_object_migrated(naming::gid_type const& gid, | |
492 | util::unique_function_nonser<components::pinned_ptr()> && f); | |
493 | ||
494 | HPX_API_EXPORT void unmark_as_migrated(naming::gid_type const& gid); | |
495 | }} | |
496 | ||
497 | #endif // HPX_A55506A4_4AC7_4FD0_AB0D_ED0D1368FCC5 | |
498 | ||
499 |
Copyright (c) 2006-2012 Rogue Wave Software, Inc. All Rights Reserved.
Patents pending.