我的反对是采取行动,然后在再次采取行动之前睡觉第二次。 然而,该物体有各种变数,无论在第二个睡眠期,均须随时取用。 当目标执行被中止时,其变量是否无法使用?
这是一种 Python。
感谢。
EDIT 1: Clarifying inaccessible :
Object A has variable x that Object B needs to access repeatedly. Object A sleeps for 1 second. Will there be a problem if Object B tries to use x while A is sleeping?
EDIT 2: Forgot to mention the two objects are running as individual processes (I m using processes to avoid the GIL)
EDIT:
class QueueController(Process):
def __init__(self):
Process.__init__(self)
self.queue_stream = Queue()
self.queue_language = Queue()
self.queue_expander = Queue()
self.queue_feature = Queue()
self.queue_classify = Queue()
self.db = connect_to_db()
def run(self):
# Every second, allow 10 more tweets from the raw_tweets db
# enter the queue_stream to be processed
value = 0
while True:
for i in db.raw_tweets.find().skip(value).limit(30):
self.queue_stream.put(i)
value+=30
sleep(1)
是否还有另一个使用这一奎埃勒舱位的物体仍然能够使用电线——变量,即使它睡了二次吗? 恐怕睡觉会停止处决,但也会接触这些格言——作为一方影响的变量。