Esempio n. 1
0
        public static bool TryGetQuota(int count, FootsiteType footsite)
        {
            bool res = false;

            lock (m_lock)
            {
                if (m_isInitialized)
                {
                    if (m_sitesTiers[footsite].TryGetQuota(count, m_currentTier))
                    {
                        if ((int)m_currentTier - m_currentLocksCount >= count)
                        {
                            m_currentLocksCount += count;

                            res = true;
                        }
                        else
                        {
                            m_sitesTiers[footsite].ReleaseQuota(count, m_currentTier);
                        }
                    }
                }
            }

            return(res);
        }
Esempio n. 2
0
        public static void ReleaseQuota(int count, FootsiteType footsite)
        {
            lock (m_lock)
            {
                if (m_isInitialized)
                {
                    m_sitesTiers[footsite].ReleaseQuota(count, m_currentTier);

                    m_currentLocksCount -= count;
                }
            }
        }