DPsim
Public Member Functions | List of all members
DPsim::Barrier Class Reference

#include <Scheduler.h>

Public Member Functions

 Barrier ()=delete
 Constructor without parameters is forbidden.
 
 Barrier (Int limit, Bool useCondition=false)
 
void wait ()
 
void signal ()
 

Detailed Description

A barrier is used to synchronize threads. Threads running into the barrier have to wait until the barrier state is released when a defined number of threads reaches the barrier.

Definition at line 118 of file Scheduler.h.

Constructor & Destructor Documentation

◆ Barrier()

DPsim::Barrier::Barrier ( Int  limit,
Bool  useCondition = false 
)
inline

Limit sets the number of threads that need to reach the barrier to release it.

Definition at line 124 of file Scheduler.h.

Member Function Documentation

◆ signal()

void DPsim::Barrier::signal ( )
inline

Increases the barrier counter like wait does, but does not wait for it to reach the limit (so this does not provide any synchronization with other threads). Can be used to eliminate unnecessary waits if multiple barriers are used in sequence.

Definition at line 165 of file Scheduler.h.

◆ wait()

void DPsim::Barrier::wait ( )
inline

Blocks until |limit| calls have been made, at which point all threads return. Provides synchronization, i.e. all writes from before this call are visible in all threads after this call.

Definition at line 130 of file Scheduler.h.


The documentation for this class was generated from the following file: