C# 클래스 ServerToolkit.BufferManagement.BufferPool

Provides a pool of buffers that can be used to efficiently allocate memory for asynchronous socket operations
상속: IBufferPool
파일 보기 프로젝트 열기: tenor/ServerToolkit 1 사용 예제들

Private Properties

프로퍼티 타입 설명
GetFilledBuffer IBuffer
GetSingleSlabPool bool
SetSingleSlabPool void
TryAllocateBlocksInSlabs long
TryFreeSlabs void

공개 메소드들

메소드 설명
BufferPool ( long slabSize, int initialSlabs, int subsequentSlabs ) : System

Initializes a new instance of the BufferPool class

GetBuffer ( long size ) : IBuffer

Creates a buffer of the specified size

GetBuffer ( long size, byte filledWith ) : IBuffer

Creates a buffer of the specified size, filled with the contents of a specified byte array

비공개 메소드들

메소드 설명
GetFilledBuffer ( IList allocatedBlocks, byte filledWith ) : IBuffer

Helper method that gets a filled buffer constructed from a list of memory blocks

GetSingleSlabPool ( ) : bool
SetSingleSlabPool ( bool value ) : void
TryAllocateBlocksInSlabs ( long totalLength, int maxBlocks, IMemorySlab slabs, List &allocatedBlocks ) : long

Helper method that searches for free blocks in an array of slabs and returns allocated blocks

TryFreeSlabs ( ) : void

Searches for empty slabs and frees one if there are more than InitialSlabs number of slabs.

메소드 상세

BufferPool() 공개 메소드

Initializes a new instance of the BufferPool class
public BufferPool ( long slabSize, int initialSlabs, int subsequentSlabs ) : System
slabSize long Length, in bytes, of a slab in the BufferPool
initialSlabs int Number of slabs to create initially
subsequentSlabs int Number of additional slabs to create at a time
리턴 System

GetBuffer() 공개 메소드

Creates a buffer of the specified size
public GetBuffer ( long size ) : IBuffer
size long Buffer size, in bytes
리턴 IBuffer

GetBuffer() 공개 메소드

Creates a buffer of the specified size, filled with the contents of a specified byte array
public GetBuffer ( long size, byte filledWith ) : IBuffer
size long Buffer size, in bytes
filledWith byte Byte array to copy to buffer
리턴 IBuffer