mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
refactor(lib): use num-processors
This C function was introduced in Emacs 28.1.
This commit is contained in:
@ -83,6 +83,8 @@
|
|||||||
"Return the max number of processing units on this system.
|
"Return the max number of processing units on this system.
|
||||||
Tries to be portable. Returns 1 if cannot be determined."
|
Tries to be portable. Returns 1 if cannot be determined."
|
||||||
(with-memoization (get 'doom-system-cpus 'cached-value)
|
(with-memoization (get 'doom-system-cpus 'cached-value)
|
||||||
|
(if (fboundp 'num-processors)
|
||||||
|
(num-processors) ; added in Emacs 28.1
|
||||||
(let ((cpus
|
(let ((cpus
|
||||||
(cond ((fboundp 'w32-get-nproc)
|
(cond ((fboundp 'w32-get-nproc)
|
||||||
(w32-get-nproc))
|
(w32-get-nproc))
|
||||||
@ -105,7 +107,7 @@ Tries to be portable. Returns 1 if cannot be determined."
|
|||||||
(string-to-number (cdr cpus))
|
(string-to-number (cdr cpus))
|
||||||
(user-error "Failed to look up number of processors, because:\n\n%s"
|
(user-error "Failed to look up number of processors, because:\n\n%s"
|
||||||
(cdr cpus)))))
|
(cdr cpus)))))
|
||||||
1)))))
|
1))))))
|
||||||
|
|
||||||
(provide 'doom-lib '(system))
|
(provide 'doom-lib '(system))
|
||||||
;;; system.el ends here
|
;;; system.el ends here
|
||||||
|
Reference in New Issue
Block a user