Exemplo n.º 1
0
 private static void CheckForPool(
     int maxPoolSize = 50, int preloadCount = 0, int initCapacity = 10)
 {
     if (m_Pool == null)
     {
         m_Pool = new SimpleInfinitePool <SimpleRangeTimer>(maxPoolSize,
                                                            delegate() { return(new SimpleRangeTimer()); },
                                                            delegate(SimpleRangeTimer item) { item.Reset(0, 0); }, // Force to zero duration.
                                                            preloadCount, initCapacity);
     }
 }
 private static void CheckForPool(
     int maxPoolSize = 50, int preloadCount = 0, int initCapacity = 10)
 {
     if (m_Pool == null)
     {
         m_Pool = new SimpleInfinitePool <DelayedActionRunner>(maxPoolSize,
                                                               delegate() { return(new DelayedActionRunner()); },
                                                               delegate(DelayedActionRunner item) { item.Reset(null, 0); },
                                                               preloadCount, initCapacity);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Resets the pool with the specified configuration.
 /// </summary>
 /// <param name="maxPoolSize">
 /// The maximum number of objects that can be stored in the pool. [Limit: >= 1]
 /// </param>
 /// <param name="preloadCount">
 /// The number of objects that will be immediately instantiated and stored in the pool.
 /// [Limit: 0 &lt;= value &lt;= <paramref name="maxPoolSize"/>]
 /// </param>
 /// <param name="initPoolCapacity">
 /// The initial capacity of the pool.
 /// [Limit: 0 &lt;= value &lt;= <paramref name="maxPoolSize"/>]
 public static void ResetPool(
     int maxPoolSize = 50, int preloadCount = 0, int initCapacity = 10)
 {
     m_Pool = null;
     CheckForPool(maxPoolSize, preloadCount, initCapacity);
 }