コード例 #1
0
    def test_write_to(self):
        person = Person(first_name="Granny", last_name="Goose")
        person.save()

        person = Person.objects.get_by_id(person.id)
        person.first_name = 'Pages'

        pipeline = person.db.pipeline()
        person.write_to(pipeline)

        with Mutex(person):
            pipeline.execute()

        person = Person.objects.get_by_id(person.id)
        self.assertEqual('Pages', person.first_name)
コード例 #2
0
 def test_lock_expired(self):
     Mutex(self.p1).lock()
     with Mutex(self.p2):
         self.assert_(True)
コード例 #3
0
 def f2(person, t):
     with Mutex(person):
         t['time'] = time.time()
コード例 #4
0
 def f1(person, t):
     with Mutex(person):
         time.sleep(0.4)
         t['time'] = time.time()