Esempio n. 1
0
        std::int64_t add_credit_to_gid(gid_type& id, std::int64_t credits)
        {
            std::int64_t c = get_credit_from_gid(id);

            c += credits;
            set_credit_for_gid(id, c);

            return c;
        }
Esempio n. 2
0
        std::int64_t remove_credit_from_gid(gid_type& id, std::int64_t debit)
        {
            std::int64_t c = get_credit_from_gid(id);
            HPX_ASSERT(c > debit);

            c -= debit;
            set_credit_for_gid(id, c);

            return c;
        }
Esempio n. 3
0
        std::int64_t fill_credit_for_gid(gid_type& id,
            std::int64_t credits)
        {
            std::int64_t c = get_credit_from_gid(id);
            HPX_ASSERT(c <= credits);

            std::int64_t added = credits - c;
            set_credit_for_gid(id, credits);

            return added;
        }
Esempio n. 4
0
        std::int64_t replenish_credits(gid_type& gid)
        {
            std::int64_t added_credit = 0;

            {
                typedef std::unique_lock<gid_type::mutex_type> scoped_lock;
                scoped_lock l(gid);
                HPX_ASSERT(0 == get_credit_from_gid(gid));

                added_credit = naming::detail::fill_credit_for_gid(gid);
                naming::detail::set_credit_split_mask_for_gid(gid);
            }

            gid_type unlocked_gid = gid;        // strips lock-bit

            return agas::incref(unlocked_gid, added_credit);
        }
Esempio n. 5
0
File: name.cpp Progetto: viboes/hpx
        hpx::unique_future<bool> replenish_credits(gid_type& id)
        {
            boost::int64_t added_credit = 0;

            {
                gid_type::mutex_type::scoped_lock l(&id);

                HPX_ASSERT(0 == get_credit_from_gid(id));
                added_credit = naming::detail::fill_credit_for_gid(id);
                naming::detail::set_credit_split_mask_for_gid(id);

                agas::add_incref_request(added_credit,
                    naming::id_type(id, id_type::unmanaged));
            }

            return agas::incref_async(id, added_credit);
        }
Esempio n. 6
0
        boost::int64_t replenish_credits(gid_type& gid)
        {
            boost::int64_t added_credit = 0;

            {
                typedef gid_type::mutex_type::scoped_lock scoped_lock;
                scoped_lock l(gid);
                HPX_ASSERT(0 == get_credit_from_gid(gid));

                added_credit = naming::detail::fill_credit_for_gid(gid);
                naming::detail::set_credit_split_mask_for_gid(gid);
            }


            gid_type unlocked_gid = gid;        // strips lock-bit

            return agas::incref(unlocked_gid, HPX_GLOBALCREDIT_INITIAL);
        }