SRMutex.h 718 B

12345678910111213141516171819202122
  1. //
  2. // Copyright (c) 2016-present, Facebook, Inc.
  3. // All rights reserved.
  4. //
  5. // This source code is licensed under the BSD-style license found in the
  6. // LICENSE file in the root directory of this source tree. An additional grant
  7. // of patent rights can be found in the PATENTS file in the same directory.
  8. //
  9. #import <Foundation/Foundation.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. typedef __attribute__((capability("mutex"))) pthread_mutex_t *SRMutex;
  12. extern SRMutex SRMutexInitRecursive(void);
  13. extern void SRMutexDestroy(SRMutex mutex);
  14. extern void SRMutexLock(SRMutex mutex) __attribute__((acquire_capability(mutex)));
  15. extern void SRMutexUnlock(SRMutex mutex) __attribute__((release_capability(mutex)));
  16. NS_ASSUME_NONNULL_END