2 Struct N_PARALLEL_TEAM
gullradriel edited this page 2026-10-30 03:26:30 +01:00

N_PARALLEL_TEAM

A team of threads kept alive between parallel loops. More...

Public Attributes

Name
N_PARALLEL_WORKER * workers
the size - 1 workers
void * user
the current loop: passed to the work
int stopping
1 when the workers must exit; written under lock, read with __atomic loads
pthread_cond_t start
signalled when a new loop is published or the team is stopping
size_t size
participants, the caller of a loop included
pthread_mutex_t run_lock
serializes the loops of the threads sharing the team
size_t pending
workers that have not finished the current loop yet (__atomic)
size_t nb_slices
the current loop: number of slices
pthread_mutex_t lock
guards every field below
unsigned long long generation
bumped once per published loop, workers compare it to the last they ran; written under lock, read with __atomic loads while spinning
N_PARALLEL_FN fn
the current loop: the work
pthread_cond_t done
signalled when the last worker is done with the current loop
size_t count
the current loop: item count
size_t begin
the current loop: first index

Detailed Description

struct N_PARALLEL_TEAM;

A team of threads kept alive between parallel loops.

A team of threads kept alive between parallel loops, see n_parallel_team_new().

Public Attributes Documentation

variable workers

N_PARALLEL_WORKER * workers;

the size - 1 workers

variable user

void * user;

the current loop: passed to the work

variable stopping

int stopping;

1 when the workers must exit; written under lock, read with __atomic loads

variable start

pthread_cond_t start;

signalled when a new loop is published or the team is stopping

variable size

size_t size;

participants, the caller of a loop included

variable run_lock

pthread_mutex_t run_lock;

serializes the loops of the threads sharing the team

variable pending

size_t pending;

workers that have not finished the current loop yet (__atomic)

variable nb_slices

size_t nb_slices;

the current loop: number of slices

variable lock

pthread_mutex_t lock;

guards every field below

variable generation

unsigned long long generation;

bumped once per published loop, workers compare it to the last they ran; written under lock, read with __atomic loads while spinning

variable fn

N_PARALLEL_FN fn;

the current loop: the work

variable done

pthread_cond_t done;

signalled when the last worker is done with the current loop

variable count

size_t count;

the current loop: item count

variable begin

size_t begin;

the current loop: first index