Threads Reference

This section contains reference of the multithreading utilities.

Symbols in the package CL-DATA-STRUCTURES.THREADS:
THREAD-BUFFER
Lambda List: (RANGE &KEY MAXIMUM-QUEUE-SIZE CHUNK-SIZE)
Description: Creates a proxy range that will present exactly the same content as the original range. However, when calling an aggregation function internal thread with queue will created. This allows operations performed before and after thread-buffer to run in parallel.
Returns: Instance of BUFFER-RANGE subclass. Depending on the class of the RANGE it may be a FORWARD-BUFFER-RANGE, BIDIRECTIONAL-BUFFER-RANGE or RANDOM-ACCESS-BUFFER-RANGE.
Exceptional situations:
  • Will raise a TYPE-ERROR when MAXIMAL-QUEUE-SIZE is not integer.
  • Will raise a TYPE-ERROR when CHUNK-SIZE is not integer.
  • Will raise CL-DS:ARGUMENT-VALUE-OUT-OF-BOUNDS when CHUNK-SIZE is not at least 1.
  • Will raise CL-DS:ARGUMENT-VALUE-OUT-OF-BOUNDS when MAXIMAL-QUEUE-SIZE is not at least 16.
  • Exceptions raised during aggregation will be transfered to the original thread.

Notes:
  • Thread buffer only changes the aggregation process.
  • For optimal performance results, operations performed before and after THREAD-BUFFER should take approximately the same ammount of time.
  • Unlike PARALLEL-ON-EACH or PARALLEL-MULTIPLEX, THREAD-BUFFER does not use lparallel workers.
  • Because of the above, be cautious when using THREAD-BUFFER in conjuction with GROUP-BY.

PARALLEL-MULTIPLEX
Lambda List: (RANGE &KEY KEY FUNCTION CHUNK-SIZE MAXIMUM-QUEUE-SIZE)
Description: Like CL-DS.ALG:MULTIPLEX but when aggregation is performed, multiplexing function is applied in parallel. Obtained results are then passed with a queue into the original thread.
Returns: Instance of PARALLEL-FORWARD-MULTIPLEX-PROXY.
Exceptional situations:
  • Will raise a TYPE-ERROR when MAXIMAL-QUEUE-SIZE is not integer.
  • Will raise CL-DS:ARGUMENT-VALUE-OUT-OF-BOUNDS when MAXIMAL-QUEUE-SIZE is not at least 16.
  • Will raise a TYPE-ERROR when FUNCTION is not funcallable.
  • Will raise a TYPE-ERROR when FUNCTION is not key.

See also:
  • MULTIPLEX

Notes:
  • Outside of aggregation behaves exactly like MULTIPLEX.