Class SequenceProcessorMultithread

Class Documentation

class SmartPeak::SequenceProcessorMultithread

Processes injections onto multiple threads of execution

Public Functions

inline SequenceProcessorMultithread(std::vector<InjectionHandler> &injections, const std::map<std::string, Filenames> &filenames, const std::vector<std::shared_ptr<RawDataProcessor>> &methods)
void spawn_workers(unsigned int n_threads)

Spawn a number of workers equal to the number of threads of execution offered by the CPU

Note

If the API is unable to fetch the required information, only a single thread will be used

size_t getNumWorkers(unsigned int n_threads) const

Determine the number of workers available based on the maximum available threads and the desired thread count. 1 thread will always be preserved for the GUI unless the maximum number of available threads couldn’t be determined

Parameters
  • [in] n_threads: desired number of threads to use

void run_injection_processing()

Workers run this function. It implements a loop that runs the following steps:

  • fetch an injection

  • process all methods on it

Workers decide on which injection to work according to an index fetched and incremented atomically (i_).

The loop ends when the worker fetches an index that is out of range.