blob: e78fdc84ca765085b20b7787d879aabd8912ee2a (
plain) (
blame)
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
32
33
34
35
36
37
38
39
40
41
42
|
//====== Copyright (c), Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef GCNETPACKETPOOL_H
#define GCNETPACKETPOOL_H
#include "netpacket.h"
namespace GCSDK
{
class CNetPacket;
extern int g_cNetPacket;
extern CThreadSafeMultiMemoryPool g_MemPoolMsg;
class CNetPacketPool
{
public:
#ifdef _SERVER
static int CMBPacketMemPool() { return ( CNetPacketPool::sm_MemPoolNetPacket.CubTotalSize() / k_nMegabyte ); }
static int CMBPacketMemPoolInUse() { return ( CNetPacketPool::sm_MemPoolNetPacket.CubSizeInUse() / k_nMegabyte ); }
#endif // _SERVER
static CNetPacket *AllocNetPacket() { g_cNetPacket++; return sm_MemPoolNetPacket.Alloc(); }
private:
friend class CNetPacket;
static CClassMemoryPool<CNetPacket> sm_MemPoolNetPacket;
};
} // namespace GCSDK
#endif // GCNETPACKETPOOL_H
|