3.14.2 Multi-threaded Prolog
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • The HTTP server libraries
          • Running the server
            • Multi-threaded Prolog
              • http_server/2
              • http_server_property/2
              • http_workers/2
              • http_add_worker/2
              • http_stop_server/2
              • http_current_worker/2
              • http_spawn/2
Availability::- use_module(library(http/thread_httpd)).
Sourcehttp_workers(+Port, ?Workers)
Query or manipulate the number of workers of the server identified by Port. If Workers is unbound it is unified with the number of running servers. If it is an integer greater than the current size of the worker pool new workers are created with the same specification as the running workers. If the number is less than the current size of the worker pool, this predicate inserts a number of‘quit' requests in the queue, discarding the excess workers as they finish their jobs (i.e. no worker is abandoned while serving a client).

This can be used to tune the number of workers for performance. Another possible application is to reduce the pool to one worker to facilitate easier debugging.