mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-25 20:45:58 +01:00
Fix CPU detection on OS X
This commit is contained in:
parent
2953e8c95b
commit
b89e0ce508
1 changed files with 10 additions and 1 deletions
|
|
@ -277,7 +277,16 @@ def __enter__(self):
|
|||
|
||||
def detect_ncpus():
|
||||
"""Detects the number of effective CPUs in the system"""
|
||||
return multiprocessing.cpu_count()
|
||||
ans = -1
|
||||
try:
|
||||
ans = multiprocessing.cpu_count()
|
||||
except:
|
||||
from PyQt4.Qt import QThread
|
||||
ans = QThread.idealThreadCount()
|
||||
if ans < 1:
|
||||
ans = 1
|
||||
return ans
|
||||
|
||||
|
||||
def launch(path_or_url):
|
||||
if os.path.exists(path_or_url):
|
||||
|
|
|
|||
Loading…
Reference in a new issue