FMLiveSwitchManagedCountdownLatch Class Reference

A countdown latch that will signal when the counter reaches zero. More...

Instance Methods

(int) - count
 Gets the current count on the latch. More...
 
(void) - decrement
 Decrements the counter by one and signals if it reaches zero. More...
 
(NSString *) - description
 Generates a string description of this instance. More...
 
(instancetype) - init
 Creates a new instance of the latch with an unknown count. More...
 
(instancetype) - initWithInitialCount:
 Creates a new instance of the latch with a count. More...
 
(void) - reset
 Resets the latch with an unknown count. More...
 
(void) - resetWithInitialCount:
 Resets the latch with a count. More...
 
(void) - setCount:
 Sets the counter for the latch. More...
 
(FMLiveSwitchFuture< id > *) - waitAsync
 Returns a promise that resolves once the counter reaches zero. More...
 
(void) - waitSync
 Blocks until the counter reaches zero. More...
 

Class Methods

(FMLiveSwitchManagedCountdownLatch *) + managedCountdownLatch
 Creates a new instance of the latch with an unknown count. More...
 
(FMLiveSwitchManagedCountdownLatch *) + managedCountdownLatchWithInitialCount:
 Creates a new instance of the latch with a count. More...
 

Detailed Description

A countdown latch that will signal when the counter reaches zero.

Method Documentation

◆ count

- (int) count

Gets the current count on the latch.

◆ decrement

- (void) decrement

Decrements the counter by one and signals if it reaches zero.

◆ description

- (NSString*) description

Generates a string description of this instance.

◆ init

- (instancetype) init

Creates a new instance of the latch with an unknown count.

This will cause the latch to count into the negatives until SetCount is called.

◆ initWithInitialCount:

- (instancetype) initWithInitialCount: (int)  initialCount

Creates a new instance of the latch with a count.

Parameters
initialCountThe initial counter value.

◆ managedCountdownLatch

+ (FMLiveSwitchManagedCountdownLatch*) managedCountdownLatch

Creates a new instance of the latch with an unknown count.

This will cause the latch to count into the negatives until SetCount is called.

◆ managedCountdownLatchWithInitialCount:

+ (FMLiveSwitchManagedCountdownLatch*) managedCountdownLatchWithInitialCount: (int)  initialCount

Creates a new instance of the latch with a count.

Parameters
initialCountThe initial counter value.

◆ reset

- (void) reset

Resets the latch with an unknown count.

This will cause the latch to count into the negatives until SetCount is called.

◆ resetWithInitialCount:

- (void) resetWithInitialCount: (int)  initialCount

Resets the latch with a count.

Parameters
initialCountThe initial counter value.

◆ setCount:

- (void) setCount: (int)  count

Sets the counter for the latch.

This brings the count back up into positive numbers.

◆ waitAsync

- (FMLiveSwitchFuture<id>*) waitAsync

Returns a promise that resolves once the counter reaches zero.

◆ waitSync

- (void) waitSync

Blocks until the counter reaches zero.