Thread.cpp 624 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "il2cpp-config.h"
  2. #if IL2CPP_TARGET_DARWIN
  3. #include <sys/types.h>
  4. #if !IL2CPP_TARGET_IOS
  5. #include <libproc.h>
  6. #endif
  7. #include <unistd.h>
  8. #include <stdlib.h>
  9. #include <pthread.h>
  10. #include "os/Thread.h"
  11. namespace il2cpp
  12. {
  13. namespace os
  14. {
  15. bool Thread::GetCurrentThreadStackBounds(void** low, void** high)
  16. {
  17. #if !IL2CPP_TARGET_IOS
  18. pthread_t self = pthread_self();
  19. *high = pthread_get_stackaddr_np(self);
  20. size_t stackSize = pthread_get_stacksize_np(self);
  21. *low = (void*)((uintptr_t)high - stackSize);
  22. return true;
  23. #else
  24. return false;
  25. #endif
  26. }
  27. }
  28. }
  29. #endif