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.

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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