template <typename Held>

class ThreadSafeDeleter

Defined at line 28 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

ThreadSafeDeleter

This "holder" class is for holding instances of classes which must only be used on a single

thread, but which are safe to curry to other threads (and back) between usages. This also means

the held instance must be safe to delete on any thread after it has been moved out.

This class holds an instance of a moveable type, and ensures that the not-moved-out instance

gets deleted on the correct thread, even if the destructor of the holder is called on the wrong

thread.

One use case:

HLCPP FIDL callbacks are affinitized to the FIDL thread on which they're created. They must

only be deleted on the FIDL-handling thread they were created on. Sometimes in normal operation

it's convenient to curry a FIDL callback to another thread, then back to the FIDL thread to get

called and deleted. However, when shutting down, the currying can be cut short and the lambda

currying the callback can be deleted on the wrong thread.

Public Methods

void ThreadSafeDeleter<Held> (const ThreadSafeDeleter<Held> & other)

Defined at line 39 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

ThreadSafeDeleter<Held> & operator= (const ThreadSafeDeleter<Held> & other)

Defined at line 40 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

void ThreadSafeDeleter<Held> (ClosureQueue * closure_queue, Held && held)

closure_queue - a ClosureQueue that'll out-last the ThreadSafeDeleter, which can be used to

run the held's destructor on the correct thread.

Defined at line 54 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

void ~ThreadSafeDeleter<Held> ()

Defined at line 62 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

void ThreadSafeDeleter<Held> (ThreadSafeDeleter<Held> && other)

move-only, no copy

Defined at line 67 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

ThreadSafeDeleter<Held> & operator= (ThreadSafeDeleter<Held> && other)

Defined at line 77 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h

Held & held ()

Defined at line 89 of file ../../zircon/system/ulib/thread-safe-deleter/include/lib/thread-safe-deleter/thread_safe_deleter.h