class NestedScheduler::ThreadPool

Defined in:

nested_scheduler/thread_pool.cr

Constant Summary

WORKER_NAME = "Worker Loop"

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(io_context : NestedScheduler::IOContext, result_handler : NestedScheduler::Result, count = 1, bootstrap = false, name : Nil | String = nil) #

[View source]

Class Method Detail

def self.nursery(thread_count = 1, name = "Child pool", io_context = nil, result_handler = NestedScheduler::Results::ErrorPropagator.new, &) #

[View source]

Instance Method Detail

def cancel #

TODO Investigate cancellation contexts, a la https://vorpus.org/blog/timeouts-and-cancellation-for-humans/


[View source]
def canceled? #

Has the pool been canceled?


[View source]
def done? #

[View source]
def done_channel : Channel(Nil) #

[View source]
def done_channel=(done_channel : Channel(Nil)) #

[View source]

[View source]
def fibers=(fibers : NestedScheduler::LinkedList2(Fiber)) #

[View source]
def finishing? #

[View source]
def inspect #
Description copied from class Object

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

This method should usually not be overridden. It delegates to #inspect(IO) which can be overridden for custom implementations.

Also see #to_s.


[View source]
def io_context : NestedScheduler::IOContext #

[View source]
def io_context=(io_context : NestedScheduler::IOContext) #

[View source]
def name : String | Nil #

[View source]
def name=(name : String | Nil) #

[View source]
def next_thread! #

[View source]
def register_fiber(fiber) #

[View source]
def result_handler : NestedScheduler::Result #

[View source]
def result_handler=(result_handler : NestedScheduler::Result) #

[View source]
def spawn(*, name : String | Nil = nil, same_thread = false, &block : -> _) : Fiber #

[View source]
def spawned : Atomic(Int32) #

[View source]
def spawned=(spawned : Atomic(Int32)) #

[View source]
def state #

[View source]
def unregister_fiber(fiber) #

[View source]
def wait_until_done #

[View source]
def workers : Array(Thread) #

[View source]
def workers=(workers : Array(Thread)) #

[View source]

Macro Detail

macro collect(t, **options) #

Collects the return values of the fiber blocks, in unspecified order. If an exception happen, it is propagated.


[View source]