fm.liveswitch.ManagedCountdownLatch Class Reference

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

Public Member Functions

void decrement ()
 Decrements the counter by one and signals if it reaches zero. More...
 
int getCount ()
 Gets the current count on the latch. More...
 
 ManagedCountdownLatch ()
 Creates a new instance of the latch with an unknown count. More...
 
 ManagedCountdownLatch (int initialCount)
 Creates a new instance of the latch with a count. More...
 
void reset ()
 Resets the latch with an unknown count. More...
 
void reset (int initialCount)
 Resets the latch with a count. More...
 
void setCount (int count)
 Sets the counter for the latch. More...
 
String toString ()
 Generates a string description of this instance. More...
 
fm.liveswitch.Future< Object > waitAsync ()
 Returns a promise that resolves once the counter reaches zero. More...
 
void waitSync ()
 Blocks until the counter reaches zero. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ManagedCountdownLatch() [1/2]

fm.liveswitch.ManagedCountdownLatch.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.

◆ ManagedCountdownLatch() [2/2]

fm.liveswitch.ManagedCountdownLatch.ManagedCountdownLatch ( int  initialCount)

Creates a new instance of the latch with a count.

Parameters
initialCountThe initial counter value.

Member Function Documentation

◆ decrement()

void fm.liveswitch.ManagedCountdownLatch.decrement ( )

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

◆ getCount()

int fm.liveswitch.ManagedCountdownLatch.getCount ( )

Gets the current count on the latch.

◆ reset() [1/2]

void fm.liveswitch.ManagedCountdownLatch.reset ( )

Resets the latch with an unknown count.

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

◆ reset() [2/2]

void fm.liveswitch.ManagedCountdownLatch.reset ( int  initialCount)

Resets the latch with a count.

Parameters
initialCountThe initial counter value.

◆ setCount()

void fm.liveswitch.ManagedCountdownLatch.setCount ( int  count)

Sets the counter for the latch.

This brings the count back up into positive numbers.

◆ toString()

String fm.liveswitch.ManagedCountdownLatch.toString ( )

Generates a string description of this instance.

◆ waitAsync()

fm.liveswitch.Future<Object> fm.liveswitch.ManagedCountdownLatch.waitAsync ( )

Returns a promise that resolves once the counter reaches zero.

◆ waitSync()

void fm.liveswitch.ManagedCountdownLatch.waitSync ( )

Blocks until the counter reaches zero.