YYSentinel.h 675 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // YYSentinel.h
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 15/4/13.
  6. // Copyright (c) 2015 ibireme.
  7. //
  8. // This source code is licensed under the MIT-style license found in the
  9. // LICENSE file in the root directory of this source tree.
  10. //
  11. #import <Foundation/Foundation.h>
  12. NS_ASSUME_NONNULL_BEGIN
  13. /**
  14. YYSentinel is a thread safe incrementing counter.
  15. It may be used in some multi-threaded situation.
  16. */
  17. @interface YYSentinel : NSObject
  18. /// Returns the current value of the counter.
  19. @property (readonly) int32_t value;
  20. /// Increase the value atomically.
  21. /// @return The new value.
  22. - (int32_t)increase;
  23. @end
  24. NS_ASSUME_NONNULL_END