C# 클래스 Microsoft.Isam.Esent.Interop.CallbackWrappers

A collection of wrapped callbacks. This is used when the wrapped callback can be garbage collected. The wrappers should be removed from the collection when the callback is collected.

Removing the wrappers can lead to crashes. In this case we trust the client code to keep its callback alive until ESENT doesn't need it any more. Once the wrapped callback is garbage collected we allow the wrapper to be collected as well. If ESENT subsequently uses the callback there will be a crash.

The reason this is hard to deal with is that the lifetime of a JET_CALLBACK isn't very clear. Table callbacks can stick around until the table meta-data is purged, while a JetDefragment callback can be used until defrag ends. On the other hand, keeping the callback wrapper alive indefinitely could lead to unbounded memory use.

파일 보기 프로젝트 열기: ayende/managed-esent 1 사용 예제들

공개 메소드들

메소드 설명
Add ( JET_CALLBACK callback ) : JetCallbackWrapper

Wrap a callback and returns its wrapper. If the callback is already wrapped then the existing wrapper is returned.

Collect ( ) : void

Go through the collection of callback wrappers and remove any dead callbacks.

비공개 메소드들

메소드 설명
TryFindWrapperFor ( JET_CALLBACK callback, JetCallbackWrapper &wrapper ) : bool

Look in the list of callback wrappers to see if there is already an entry for this callback.

메소드 상세

Add() 공개 메소드

Wrap a callback and returns its wrapper. If the callback is already wrapped then the existing wrapper is returned.
public Add ( JET_CALLBACK callback ) : JetCallbackWrapper
callback JET_CALLBACK The callback to add.
리턴 JetCallbackWrapper

Collect() 공개 메소드

Go through the collection of callback wrappers and remove any dead callbacks.
public Collect ( ) : void
리턴 void