mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #576 from cr1901/no-resource
Gate POSIX-only signals and resource module to only run on POSIX Pyth…
This commit is contained in:
commit
dfc0c8ffc8
|
@ -17,7 +17,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys, re, os, signal
|
import sys, re, os, signal
|
||||||
import resource, subprocess
|
import subprocess
|
||||||
|
if os.name == "posix":
|
||||||
|
import resource
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from select import select
|
from select import select
|
||||||
from time import time
|
from time import time
|
||||||
|
@ -27,11 +29,12 @@ from threading import Thread
|
||||||
|
|
||||||
# This is needed so that the recursive SMT2 S-expression parser
|
# This is needed so that the recursive SMT2 S-expression parser
|
||||||
# does not run out of stack frames when parsing large expressions
|
# does not run out of stack frames when parsing large expressions
|
||||||
smtio_reclimit = 64 * 1024
|
if os.name == "posix":
|
||||||
smtio_stacksize = 128 * 1024 * 1024
|
smtio_reclimit = 64 * 1024
|
||||||
if sys.getrecursionlimit() < smtio_reclimit:
|
smtio_stacksize = 128 * 1024 * 1024
|
||||||
|
if sys.getrecursionlimit() < smtio_reclimit:
|
||||||
sys.setrecursionlimit(smtio_reclimit)
|
sys.setrecursionlimit(smtio_reclimit)
|
||||||
if resource.getrlimit(resource.RLIMIT_STACK)[0] < smtio_stacksize:
|
if resource.getrlimit(resource.RLIMIT_STACK)[0] < smtio_stacksize:
|
||||||
resource.setrlimit(resource.RLIMIT_STACK, (smtio_stacksize, -1))
|
resource.setrlimit(resource.RLIMIT_STACK, (smtio_stacksize, -1))
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,8 +54,9 @@ def force_shutdown(signum, frame):
|
||||||
os.kill(p.pid, signal.SIGTERM)
|
os.kill(p.pid, signal.SIGTERM)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if os.name == "posix":
|
||||||
|
signal.signal(signal.SIGHUP, force_shutdown)
|
||||||
signal.signal(signal.SIGINT, force_shutdown)
|
signal.signal(signal.SIGINT, force_shutdown)
|
||||||
signal.signal(signal.SIGHUP, force_shutdown)
|
|
||||||
signal.signal(signal.SIGTERM, force_shutdown)
|
signal.signal(signal.SIGTERM, force_shutdown)
|
||||||
|
|
||||||
def except_hook(exctype, value, traceback):
|
def except_hook(exctype, value, traceback):
|
||||||
|
@ -1053,4 +1057,3 @@ class MkVcd:
|
||||||
print("b0 %s" % self.nets[path][0], file=self.f)
|
print("b0 %s" % self.nets[path][0], file=self.f)
|
||||||
else:
|
else:
|
||||||
print("b1 %s" % self.nets[path][0], file=self.f)
|
print("b1 %s" % self.nets[path][0], file=self.f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue