QNSystemTool.m 508 B

123456789101112131415161718192021222324
  1. //
  2. // QNSystemTool.m
  3. // QiniuSDK
  4. //
  5. // Created by WorkSpace_Sun on 2020/4/2.
  6. // Copyright © 2020 Qiniu. All rights reserved.
  7. //
  8. #import "QNSystemTool.h"
  9. #include <pthread.h>
  10. @implementation QNSystemTool
  11. + (int64_t)getCurrentProcessID {
  12. return [[NSProcessInfo processInfo] processIdentifier];
  13. }
  14. + (int64_t)getCurrentThreadID {
  15. __uint64_t threadId = 0;
  16. if (pthread_threadid_np(0, &threadId)) {
  17. threadId = pthread_mach_thread_np(pthread_self());
  18. }
  19. return threadId;
  20. }
  21. @end