예제 #1
0
 def test_twoThreads(self):
     lock = thread.allocate_lock()
     topConnection.push(2)
     def x():
         try:
             self.assertTrue(topConnection.isEmpty())
             topConnection.push(1)
         finally:
             lock.release()
     lock.acquire()
     thread.start_new(x, ())
     self.assertEquals(topConnection.top(), 2)
예제 #2
0
 def x():
     try:
         self.assertTrue(topConnection.isEmpty())
         topConnection.push(1)
     finally:
         lock.release()
예제 #3
0
 def __enter__(self):
     topConnection.push(self)