You may already know about a similar project a friend of mine (hi, Steffen!) did a few years ago called Python Object Sharing (POSH). This was however unix specific and relied on fork and SYSV IPC iirc. I see he has a SF projectpage here:
http://poshmodule.sourceforge.net/ (doesn't seem to be a lot of activity there, though). Best regards __ Audun Ostrem Nordal tel: +41.22.76.74427 CERN IT/IS 1211 Geneve 23 Switzerland > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Richard Oudkerk > Sent: Monday, October 09, 2006 1:59 PM > To: python-dev@python.org > Subject: [Python-Dev] Cloning threading.py using proccesses > > I am not sure how sensible the idea is, but I have had a > first stab at writing a module processing.py which is a near > clone of threading.py but uses processes and sockets for > communication. (It is one way of avoiding the GIL.) > > I have tested it on unix and windows and it seem to work pretty well. > (Getting round the lack of os.fork on windows is a bit > awkward.) There is also another module dummy_processing.py > which has the same api but is just a wrapper round threading.py. > > Queues, Locks, RLocks, Conditions, Semaphores and some other > shared objects are implemented. > > People are welcome to try out the tests in test_processing.py > contained in the zipfile. More information is included in > the README file. > > As a quick example, the code > > . from processing import Process, Queue, ObjectManager > . > . def f(token): > . q = proxy(token) > . for i in range(10): > . q.put(i*i) > . q.put('STOP') > . > . if __name__ == '__main__': > . manager = ObjectManager() > . token = manager.new(Queue) > . queue = proxy(token) > . > . t = Process(target=f, args=[token]) > . t.start() > . > . result = None > . while result != 'STOP': > . result = queue.get() > . print result > . > . t.join() > > is not very different from the normal threaded equivalent > > . from threading import Thread > . from Queue import Queue > . > . def f(q): > . for i in range(10): > . q.put(i*i) > . q.put('STOP') > . > . if __name__ == '__main__': > . queue = Queue() > . > . t = Thread(target=f, args=[queue]) > . t.start() > . > . result = None > . while result != 'STOP': > . result = queue.get() > . print result > . > . t.join() > > Richard > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com