-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
latch & barrier #15
Comments
I've implemented and published those latch & barrier features with the |
latch and barriers are now regular features in the C++20. They must be escaped from the |
https://github.com/cplusplus/draft/blob/master/papers/n4830.pdf Definition of latch and barriers are fixed like below: Latchnamespace std
{
export class Latch
{
public constructor(size: number);
public count_down(): Promise<void>;
public arrive_and_wait(): Promise<void>;
public try_wait(): Promise<boolean>;
public wait(): Promise<void>;
public wait_for(ms: number): Promise<boolean>;
public wait_until(at: Date): Promise<boolean>;
}
} Barriernamespace std
{
export class Barrier extends FlexBarrier
{
public constructor(size: number);
}
export class FlexBarrier
{
public constructor(size: number);
public constructor(size: number, completion: () => number);
public arrive(n: number = 1): Promise<void>;
public arrive_and_wait(): Promise<void>;
public arrive_and_drop(): Promise<void>;
public wait(): Promise<void>;
}
} |
Latch
andBarrier
are thread supporting classes who can block critical sections with downward counter. They're strong candidates who may come into the C++20 revision. Thus, it would better to implement them into theexperimental
namespace.Latch
The
Latch
class locks a critical section until its downward counter to be zero.Barrier
The
Barrier
class can re-use the downward counter..The text was updated successfully, but these errors were encountered: