class ThreadPool

Defined at line 109 of file ../../src/devices/bin/driver_runtime/dispatcher.h

Public Members

static basic_string_view kNoSchedulerRole

Public Methods

void ThreadPool (std::string_view scheduler_role, bool unmanaged)

Defined at line 114 of file ../../src/devices/bin/driver_runtime/dispatcher.h

std::string GetKey ()

Required to instantiate fbl::DefaultKeyedObjectTraits.

Defined at line 121 of file ../../src/devices/bin/driver_runtime/dispatcher.h

uint32_t num_threads ()

Returns the number of threads that have been started on |loop_|.

Defined at line 156 of file ../../src/devices/bin/driver_runtime/dispatcher.h

uint32_t thread_limit ()

Defined at line 161 of file ../../src/devices/bin/driver_runtime/dispatcher.h

zx_status_t set_thread_limit (uint32_t max_threads)

Defined at line 166 of file ../../src/devices/bin/driver_runtime/dispatcher.h

uint32_t num_dispatchers ()

Defined at line 177 of file ../../src/devices/bin/driver_runtime/dispatcher.h

bool is_unmanaged ()

Defined at line 182 of file ../../src/devices/bin/driver_runtime/dispatcher.h

std::string_view scheduler_role ()

Defined at line 184 of file ../../src/devices/bin/driver_runtime/dispatcher.h

async::Loop * loop ()

Defined at line 185 of file ../../src/devices/bin/driver_runtime/dispatcher.h

zx_status_t AddThread ()

Starts a new thread on the thread pool unconditionally.

Defined at line 2070 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

zx_status_t OnDispatcherSealed ()

Decrements the number of required threads. Currently this doesn't spin down the extra thread

but for now that is ok since more often than not it can be used by another dispatcher on the

thread-pool. If it is not used, there will simply be one more thread than needed.

TODO(https://fxbug.dev/326266527): Use a timer to spin down un-necessary thread.

Defined at line 2098 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

zx_status_t OnDispatcherAdded (Dispatcher & dispatcher)

Updates the number of threads needed in the thread pool. Starts a new thread if needed.

Defined at line 2105 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

void OnDispatcherRemoved (Dispatcher & dispatcher)

Updates the number of threads needed in the thread pool.

Defined at line 2131 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

zx_status_t SetRoleProfile ()

Requests the profile provider set the role profile.

Defined at line 2036 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

void Reset ()

Resets to 0 threads.

Must only be called when there are no outstanding dispatchers.

Must not be called from within a driver_runtime managed thread as that will result in a

deadlock.

Defined at line 2143 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

void CacheUnboundIrq (std::unique_ptr<driver_runtime::Dispatcher::AsyncIrq> irq)

Stores |irq| which has been unbound.

This is avoid destroying the irq wrapper immediately after unbinding, as it's possible

another thread in the thread pool has already pulled an irq packet

from the port and may attempt to call the irq handler.

Defined at line 2165 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

void OnThreadWakeup ()

Updates the thread tracking and checks whether to garbage collect the current generation of

irqs.

Defined at line 2170 of file ../../src/devices/bin/driver_runtime/dispatcher.cc

bool ScanThreadsForStalls ()

Defined at line 2001 of file ../../src/devices/bin/driver_runtime/dispatcher.cc