Struct coco::epoch::Scope
[−]
[src]
pub struct Scope { /* fields omitted */ }
A witness that the current thread is pinned.
A reference to Scope
is proof that the current thread is pinned. Lots of methods that interact
with Atomic
s can safely be called only while the thread is pinned so they often require a
reference to Scope
.
This data type is inherently bound to the thread that created it, therefore it does not
implement Send
nor Sync
.
Methods
impl Scope
[src]
unsafe fn defer_free<T>(&self, ptr: Ptr<T>)
[src]
Stashes away an object that will later be freed.
This function inserts the object into a thread-local buffer. When the buffers becomes full,
it's objects are flushed into the globally shared Garbage
instance.
If the object is unusually large, it is wise to follow up with a call to flush
so that
it doesn't get stuck waiting in the buffer for a long time.
unsafe fn defer_drop<T>(&self, ptr: Ptr<T>)
[src]
Adds an object that will later be dropped and freed.
The specified object is an array allocated at address object
and consists of count
elements of type T
.
This method inserts the object into the garbage buffer. When the buffers becomes full, it's objects are flushed into the garbage queue.
Note: The object must be Send + 'self
.
fn flush(&self)
[src]
Flushes the buffered thread-local garbage.
It is wise to flush the garbage just after passing a very large object to defer_free
,
so that it isn't sitting in the buffer for a long time.