Skip to content

Latest commit

 

History

History
212 lines (152 loc) · 4.28 KB

ThreadPool.md

File metadata and controls

212 lines (152 loc) · 4.28 KB

ThreadPool

  • class ThreadPool (php\lang\ThreadPool)
  • package std
  • source php/lang/ThreadPool.php

Description

Class ThreadPool


Static Methods


Methods


Static Methods

create()

ThreadPool::create(int $coreSize, int $maxSize, int $keepAliveTime): ThreadPool

createFixed()

ThreadPool::createFixed(int $max): ThreadPool

createCached()

ThreadPool::createCached(): ThreadPool

createSingle()

ThreadPool::createSingle(): ThreadPool

Creates an Executor that uses a single worker thread operating off an unbounded queue.


createScheduled()

ThreadPool::createScheduled(int $corePoolSize): ThreadPool

Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically.


Methods

__construct()

__construct(): void

internal


isScheduled()

isScheduled(): bool

Is Scheduled ?


isShutdown()

isShutdown(): bool

Is Shutdown?


isTerminated()

isTerminated(): bool

execute()

execute(callable $runnable, php\lang\Environment $env): void

Execute some $runnable via the Executor Service


submit()

submit(callable $runnable, php\lang\Environment $env): Future

schedule()

schedule(callable $runnable, int $delay, php\lang\Environment $env): Future

shutdown()

shutdown(): void

Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.


shutdownNow()

shutdownNow(): void

Attempts to stop all actively executing tasks, halts the processing of waiting tasks


awaitTermination()

awaitTermination(int $timeout): bool

Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.


getActiveCount()

getActiveCount(): int

Returns the approximate number of threads that are actively executing tasks.


getTaskCount()

getTaskCount(): int|null

Returns the approximate total number of tasks that have ever been scheduled for execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation.