def __init__(self): self.update = True self.gladefile = 'election.glade' self.wTree = gtk.glade.XML(self.gladefile, 'mainWindow') self.wTree.signal_autoconnect(self) self.wTree.get_widget('mainWindow').set_icon_from_file('obama.gif') self.init_widgets() self.pipe, pipe = Pipe() if os.name == 'nt': freezeSupport() self.p = Updater(pipe) self.p.start() self.update_projection() gobject.idle_add(self.update_results)
print print '\n\t######## testing threading.Lock\n' test_lockspeed(threading.Lock()) print '\n\t######## testing threading.RLock\n' test_lockspeed(threading.RLock()) print '\n\t######## testing processing.Lock\n' test_lockspeed(processing.Lock()) print '\n\t######## testing processing.RLock\n' test_lockspeed(processing.RLock()) print '\n\t######## testing lock managed by server process\n' test_lockspeed(manager.Lock()) print '\n\t######## testing rlock managed by server process\n' test_lockspeed(manager.RLock()) print print '\n\t######## testing threading.Condition\n' test_conditionspeed(threading.Thread, threading.Condition()) print '\n\t######## testing processing.Condition\n' test_conditionspeed(processing.Process, processing.Condition()) print '\n\t######## testing condition managed by a server process\n' test_conditionspeed(processing.Process, manager.Condition()) gc.enable() if __name__ == '__main__': processing.freezeSupport() test()
manager.start() print '-' * 20 f1 = manager.Foo1() f1.f() f1.g() assert not hasattr(f1, '_h') print '-' * 20 f2 = manager.Foo2() f2.g() f2._h() assert not hasattr(f2, 'f') print '-' * 20 it = manager.baz() for i in it: print '<%d>' % i, print ## if __name__ == '__main__': freezeSupport() test()
for worker in pool._pool: assert not worker.isAlive() print '\tterminate() succeeded\n' # # Check garbage collection # print 'Testing garbage collection:' pool = Pool(2) processes = pool._pool ignore = pool.apply(pow3, [2]) results = [pool.applyAsync(time.sleep, [10]) for i in range(10)] del results, pool time.sleep(0.2) for worker in processes: assert not worker.isAlive() print '\tgarbage collection succeeded\n' if __name__ == '__main__': freezeSupport() test()
test_join_timeout, test_event, test_sharedvalues ]: print '\n\t######## %s\n' % func.__name__ func() ignore = processing.activeChildren() # cleanup any old processes if hasattr(processing, '_debugInfo'): info = processing._debugInfo() if info: print info raise ValueError, 'there should be no positive refcounts left' if __name__ == '__main__': processing.freezeSupport() assert len(sys.argv) in (1, 2) if len(sys.argv) == 1 or sys.argv[1] == 'processes': print ' Using processes '.center(79, '-') namespace = processing elif sys.argv[1] == 'manager': print ' Using processes and a manager '.center(79, '-') namespace = processing.Manager() namespace.Process = processing.Process namespace.currentProcess = processing.currentProcess namespace.activeChildren = processing.activeChildren elif sys.argv[1] == 'threads': print ' Using threads '.center(79, '-') import processing.dummy as namespace