bmk_cores_macos.bmx 592 B

12345678910111213141516171819202122232425262728293031
  1. SuperStrict
  2. ?Not bmxng
  3. Import "macos/*.h"
  4. Import "macos/macos.m"
  5. Import "macos/NSProcessInfo_PECocoaBackports.m"
  6. ?
  7. Extern
  8. ?bmxng
  9. Function sysctlbyname:Int(name:Byte Ptr, count:Int Ptr, size:Size_T Ptr, a:Byte Ptr, b:Size_T)
  10. ?Not bmxng
  11. Function sysctlbyname:Int(name:Byte Ptr, count:Int Ptr, size:Int Ptr, a:Byte Ptr, b:Int)
  12. ?
  13. End Extern
  14. Function GetCoreCount:Int()
  15. Global count:Int
  16. If Not count Then
  17. ?bmxng
  18. Local l:Size_T = 4
  19. ?Not bmxng
  20. Local l:Int = 4
  21. ?
  22. sysctlbyname("hw.ncpu", Varptr count, Varptr l,Null,0)
  23. End If
  24. Return count
  25. End Function