Skip to content

Commit

Permalink
[spec] Use os.sched_getaffinity only if available (#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshowbarker authored Feb 15, 2024
1 parent 17cf849 commit bcd1924
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion document/core/util/mathjax2katex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: latin-1 -*-

import queue
import multiprocessing
import os
import re
import shelve
Expand Down Expand Up @@ -229,7 +230,8 @@ def Worker():
sys.stderr.write('.')

q = queue.Queue()
for i in range(len(os.sched_getaffinity(0))):
for i in range(len(os.sched_getaffinity(0)) if "sched_getaffinity" in dir(os)
else multiprocessing.cpu_count()):
t = threading.Thread(target=Worker)
t.daemon = True
t.start()
Expand Down

0 comments on commit bcd1924

Please sign in to comment.