_
This commit is contained in:
@@ -366,7 +366,11 @@ class InteractBase(object):
|
|||||||
sq.put (True)
|
sq.put (True)
|
||||||
except:
|
except:
|
||||||
sq.put (False)
|
sq.put (False)
|
||||||
|
sq.close()
|
||||||
|
sq = None
|
||||||
|
import gc
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
def input_in_time (self, str, max_time_sec):
|
def input_in_time (self, str, max_time_sec):
|
||||||
sq = multiprocessing.Queue()
|
sq = multiprocessing.Queue()
|
||||||
p = multiprocessing.Process(target=self.input_process, args=( sys.stdin.fileno(), sq, str))
|
p = multiprocessing.Process(target=self.input_process, args=( sys.stdin.fileno(), sq, str))
|
||||||
@@ -381,6 +385,7 @@ class InteractBase(object):
|
|||||||
if time.time() - t > max_time_sec:
|
if time.time() - t > max_time_sec:
|
||||||
break
|
break
|
||||||
p.terminate()
|
p.terminate()
|
||||||
|
p.join()
|
||||||
sq.close()
|
sq.close()
|
||||||
old_stdin = sys.stdin
|
old_stdin = sys.stdin
|
||||||
sys.stdin = os.fdopen( os.dup(sys.stdin.fileno()) )
|
sys.stdin = os.fdopen( os.dup(sys.stdin.fileno()) )
|
||||||
|
|||||||
Reference in New Issue
Block a user