chenluhua1980
2026-01-13 155cb7fe0dcb564729c6aecdb65815f3f0ed24e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include "CGlass.h"
#include <map>
#include <list>
 
 
namespace SERVO {
    class CGlassPool
    {
    public:
        CGlassPool();
        virtual ~CGlassPool();
 
    public:
        void initPool();
        void term();
        CGlass* allocaGlass();
        void freeGlass(CGlass* pGlass);
        int getAvailableSize();
 
    private:
        inline void Lock() { EnterCriticalSection(&m_criticalSection); }
        inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
 
 
    private:
        CRITICAL_SECTION m_criticalSection;
        std::map<void*, CGlass*> m_mapOccupation;            // Ê¹ÓÃÖеÄ
        std::list<CGlass*> m_lsitAvailable;                    // ¿ÕÏеÄ
    };
}