Clean ups ThreadPool
Adds group of jobs to threadPool Spwaning group will finish after this group have finished
Adds group of jobs to threadPool, group won't be synchronized
Adds job to be executed by thread pool, group specified in group data won't be finished until this job ends If threadNum is different than -1 only thread with threadNum will be able to execute given job
Adds job to be executed by thread pool, such a job won't be synchronized with any group or job If threadNum is different than -1 only thread with threadNum will be able to execute given job It is advised to use synchronized group of jobs
Adds multiple jobs at once Range has to return JobData* Range has to have length property Range is used so there is no need to allocate JobData*[] All jobs has to belong to one group If threadNum is different than -1 only thread with threadNum will be able to execute given jobs
Default implementation of flushing logs Saves logs to trace.json file in format acceptable by Google Chrome tracking tool chrome://tracing/ Logs can be watched even if apllication crashed, but might require removing last log entry from trace.json
Explicitly calls onFlushLogs on all threads
Initialize thread pool
Registers external thread to thread pool array. There will be allocated data for this thread and it will have specified id External threads are not joined at the end of thread pool execution Returns ThreadData corresponding to external thread. To acually start executing, external thread had to call threadStartFunc() from returned variable
Allows external threads to return from threadStartFunc
Sets number of threads to accept new jobs If there were never so much threads created, they will be created If number of threads set is smaller than there was threads before, they are not joined but they stop getting new jobs, they stop stealing jobs and they sleep longer Locking operation
Unregisters external thread. Can be called only when external thread have left the thread pool
Waits for all threads to finish and joins them (excluding external threads)
Number of log cache entries. Should be set before setThreadsNum is called
User custom delegate to flush logs, if overriden defaultFlushLogs will be used. Can be sset after initialize() call
Number of times which tryWait are called before timedWait call. Higher value sets better response but takes CPU time even if there are no jobs.
Thread Pool Manages bounch of threads to execute given jobs as quickly as possible There are no priorities beetween jobs. Jobs added to queues in same order as they are in slices, but due to job stealing and uneven speed of execution beetween threads jobs execution order is unspecified. Number of threads executing jobs can be dynamically changed in any time. Threads removed from execution will work until the end of the program but shouldn't accept new jobs.