mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix CPU detection on OS X
This commit is contained in:
parent
2953e8c95b
commit
b89e0ce508
@ -277,7 +277,16 @@ class StreamReadWrapper(object):
|
||||
|
||||
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…
x
Reference in New Issue
Block a user