Checkout
Mark Michelson
committed
15 months ago
Add threadpool support to Asterisk.

This commit consists of two parts.

Part one changes the taskprocessor API to be less self-contained.
I… Show more
Add threadpool support to Asterisk.

This commit consists of two parts.

Part one changes the taskprocessor API to be less self-contained.

Instead, the taskprocessor is now more of a task queue that informs

a listener of changes to the queue. The listener then has the responsibility

of executing the tasks as it pleases. There is a default listener implementation

that functions the same way as "classic" taskprocessors, in that it creates

a single thread for tasks to execute in. Old users of taskprocessors have

not been altered and still function the same way.

Part two introduces the threadpool API. A threadpool is a special type of

taskprocessor listener that has multiple threads associated with it. The threadpool

also has an optional listener that can adjust the threadpool as conditions change.

In addition the threadpool has a set of options that can allow for the threadpool

to grow and shrink on its own as tasks are added and executed.

Both set of changes contain accompanying unit tests.

(closes issue ASTERISK-20691)

reported by Matt Jordan

Review: https://reviewboard.asterisk.org/r/2242

Show less