asipe / SupaCharge

Utility Library
MIT License
2 stars 3 forks source link

Latch implementation #53

Open asipe opened 9 years ago

asipe commented 9 years ago

Maybe this name isn't the best, but a latch mechanism that can be latched based on a policy:

Possible api:

public interface IReleasePolicy {
  bool ShouldRelease();
}

public class Latch<T> {
  public Latch(IReleasePolicy releasePolicy, Func<T> work) {}
  public T Acquire<T>() {}
  public T Acquire<T>(long waitMillis) {}
}