1 //  Copyright (c) 2007-2013 Hartmut Kaiser
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 /// \file unmanaged.hpp
7 
8 #if !defined(HPX_NAMING_UNMANAGED_NOV_12_2013_0210PM)
9 #define HPX_NAMING_UNMANAGED_NOV_12_2013_0210PM
10 
11 #include <hpx/runtime/naming/name.hpp>
12 
13 namespace hpx { namespace naming
14 {
15     /// The helper function \a hpx::unmanaged can be used to generate
16     /// a global identifier which does not participate in the automatic
17     /// garbage collection.
18     ///
19     /// \param id   [in] The id to generated the unmanaged global id from
20     ///             This parameter can be itself a managed or a unmanaged
21     ///             global id.
22     ///
23     /// \returns    This function returns a new global id referencing the
24     ///             same object as the parameter \a id. The only difference
25     ///             is that the returned global identifier does not participate
26     ///             in the automatic garbage collection.
27     ///
28     /// \note       This function allows to apply certain optimizations to
29     ///             the process of memory management in HPX. It however requires
30     ///             the user to take full responsibility for keeping the referenced
31     ///             objects alive long enough.
32     ///
unmanaged(id_type const & id)33     inline id_type unmanaged(id_type const& id)
34     {
35         return id_type(detail::strip_internal_bits_from_gid(id.get_msb()),
36             id.get_lsb(), id_type::unmanaged);
37     }
38 }}
39 
40 namespace hpx
41 {
42     using naming::unmanaged;
43 }
44 
45 #endif
46 
47 
48