> Historical note: asyncore didn't support private event loops either until
> I added the extra argument to the constructor. I'm not sure why you need
> to pass the map to anything but the constructor. Oddly. most, but not
> all of the methods that take a map, default to the one set in the
> constructor. I don't really remember the details....
AFAICT, in 2.4.2 all asyncore _methods_ default to the map passed to the
constructor. This isn't always dead obvious, but it's never truly subtle;
e.g., this is as bad as it gets:
def set_socket(self, sock, map=None):
self.socket = sock
self._fileno = sock.fileno()
The only trick there is that if you don't pass map= to set_socket(), it
passes None on to add_channel(), and add_channel() then uses self._map.
The asyncore _functions_ are a different story, but I suppose they have to
be. You do have to pass a map to poll(), poll2(), loop() and close_all(),
else they'll use the module global socket_map. But they aren't methods, so
have no way to know any better.
Also, AFAICT, this is all equally true in 2.3.5's asyncore. It's OK to stop
being afraid of bad code in Python 1.5.2 ;-)
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org