scalib.tools.ContextExecutor#

class scalib.tools.ContextExecutor(*args, **kwargs)[source]#

concurrent.futures.ThreadPoolExecutor with automatic propagation of contextvars.

The context is captured at the creation of the executor.

Initializes a new ThreadPoolExecutor instance.

Parameters:
  • max_workers – The maximum number of threads that can be used to execute the given calls.

  • thread_name_prefix – An optional name prefix to give our threads.

  • initializer – A callable used to initialize worker threads.

  • initargs – A tuple of arguments to pass to the initializer.

Methods

map(fn, *iterables[, timeout, chunksize])

Returns an iterator equivalent to map(fn, iter).

shutdown([wait, cancel_futures])

Clean-up the resources associated with the Executor.

submit(fn, /, *args, **kwargs)

Submits a callable to be executed with the given arguments.