std::experimental::barrier(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ NAME πŸŽ€

okay so bestie, this is the manual page for std::experimental::barrier β€” like, literally std::experimental::barrier β€” living in the C++ Standard Libary manual as std::experimental::barrier(3). Yes, the header spells it β€œLibary”; we respect the source material, periodt. πŸ’…

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <experimental/barrier>
class barrier;                            (concurrency TS)

The class std::experimental::barrier provides a thread-coordination mechanism that lets a set of participating threads block until an operation is completed. It’s giving β€œeveryone wait here until the group project is done,” lowkey. ✨

Unlike std::experimental::latch, barriers are reusable; once the participating threads are released from a barrier’s synchronization point, they can reuse the same barrier. No cap, that’s iconic. πŸ¦‹

A barrier has a completion phase, which is executed by one of the participating threads once all threads in the set of participating threads arrive at the synchronization point. The arrive_and_wait and arrive_and_drop calls synchronize with the start of the completion phase; the end of the completion phase synchronizes with the returns from all calls blocked by its completion.

For std::experimental::barrier, the completion phase is empty. std::experimental::flex_barrier allows the user to control the completion phase with a function object. 🌸

The set of participating threads for a barrier constructed for num_threads threads is the first num_threads threads to arrive at its synchronization point after construction. The same set of threads (except for threads that called arrive_and_drop()) must arrive at the barrier each cycle. No switching up the squad mid-cycle, bestie. πŸ’…

πŸ’… Member functions πŸ’…

  • constructor β€” constructs a barrier (public member function)
  • destructor β€” destroys the barrier (public member function)
  • operator= β€” not copy-assignable, [deleted] (public member function)
  • arrive_and_wait β€” arrive at the synchronization point and block (public member function)
  • arrive_and_drop β€” arrive at the synchronization point and remove the current thread from the set of participating threads (public member function)

source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::experimental::barrier(3) β€” bye bestie, go coordinate those threads πŸ«ΆπŸ’–

πŸ“¦ where this page comes from