A.55 library(thread_pool): Resource bounded thread management
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(thread_pool): Resource bounded thread management
          • thread_pool_create/3
          • thread_pool_destroy/1
          • current_thread_pool/1
          • thread_pool_property/2
          • thread_create_in_pool/4
          • worker_exitted/3
          • create_pool/1
    • Packages
Availability::- use_module(library(thread_pool)).(can be autoloaded)
Source[det]thread_pool_create(+Pool, +Size, +Options)
Create a pool of threads. A pool of threads is a declaration for creating threads with shared properties (stack sizes) and a limited number of threads. Threads are created using thread_create_in_pool/4. If all threads in the pool are in use, the behaviour depends on the wait option of thread_create_in_pool/4 and the backlog option described below. Options are passed to thread_create/3, except for
backlog(+MaxBackLog)
Maximum number of requests that can be suspended. Default is infinite. Otherwise it must be a non-negative integer. Using backlog(0) will never delay thread creation for this pool.

The pooling mechanism does not interact with the detached state of a thread. Threads can be created both detached and normal and must be joined using thread_join/2 if they are not detached.