class NestedScheduler::LinkedList2(T)

Overview

Same as Thread::LinkedList(T) but with different field names. There is a need of a list per thread pool in addition to the global one. Potentially it could be changed so that there isn't any global list of fibers but only one list per pool (probably a good idea - if there is many fibers then deletion becomes a bottleneck due to it being O(n)). In that case it might be a good idea to instead have Thread::LinkedList of pools for fiber iteration purpose. It would probably make it easier to get an idea of what a system is doing.

Defined in:

nested_scheduler/linked_list2.cr

Instance Method Summary

Instance Method Detail

def delete(node : T) : Nil #

Removes a node from the list. The operation is thread-safe.

There are no guarantees that a node being deleted won't be iterated by #unsafe_each until the method has returned.


[View source]
def push(node : T) : Nil #

Appends a node to the tail of the list. The operation is thread-safe.

There are no guarantees that a node being pushed will be iterated by #unsafe_each until the method has returned.


[View source]
def unsafe_each(&) : Nil #

Iterates the list without acquiring the lock, to avoid a deadlock in stop-the-world situations, where a paused thread could have acquired the lock to push/delete a node, while still being "safe" to iterate (but only during a stop-the-world).


[View source]