Commit fa0582ce authored by Jeremy Hylton's avatar Jeremy Hylton

Merge in zeo-1_0-branch

Use asyncwrap to call asyncore.loop() and asyncore.poll().
Add definition for EINTR.
parent 04e2ef59
...@@ -85,15 +85,18 @@ ...@@ -85,15 +85,18 @@
"""Simple rpc mechanisms """Simple rpc mechanisms
""" """
__version__ = "$Revision: 1.18 $"[11:-2] __version__ = "$Revision: 1.19 $"[11:-2]
from cPickle import loads from cPickle import loads
import cPickle import cPickle
from thread import allocate_lock from thread import allocate_lock
from smac import SizedMessageAsyncConnection from smac import SizedMessageAsyncConnection
import socket, string, struct, asyncore, sys, time, select import socket, string, struct, asyncore, sys, time, select
TupleType=type(())
from zLOG import LOG, TRACE, DEBUG, INFO from zLOG import LOG, TRACE, DEBUG, INFO
from ZEO import asyncwrap
from errno import EINTR
TupleType=type(())
# We create a special fast pickler! This allows us # We create a special fast pickler! This allows us
# to create slightly more efficient pickles and # to create slightly more efficient pickles and
...@@ -184,13 +187,13 @@ class asyncRPC(SizedMessageAsyncConnection): ...@@ -184,13 +187,13 @@ class asyncRPC(SizedMessageAsyncConnection):
try: r, w, e = select.select([self._fileno],[],[],0.0) try: r, w, e = select.select([self._fileno],[],[],0.0)
except select.error, v: except select.error, v:
if v[0] != EINTR: raise if v[0] != EINTR: raise
if r: asyncore.poll(0.0, self) if r: asyncwrap.poll(0.0, self)
else: break else: break
def readLoop(self): def readLoop(self):
la=self.__la la=self.__la
while not la(0): while not la(0):
asyncore.poll(60.0, self) asyncwrap.poll(60.0, self)
self.__lr() self.__lr()
def setLoop(self, map=None, Wakeup=lambda : None): def setLoop(self, map=None, Wakeup=lambda : None):
...@@ -240,7 +243,7 @@ class asyncRPC(SizedMessageAsyncConnection): ...@@ -240,7 +243,7 @@ class asyncRPC(SizedMessageAsyncConnection):
self.message_output(dump(args,1)) self.message_output(dump(args,1))
if self.__haveMainLoop: if self.__haveMainLoop:
self.__Wakeup() # Wake up the main loop self.__Wakeup() # Wake up the main loop
else: asyncore.poll(0.0, self) else: asyncwrap.poll(0.0, self)
def setOutOfBand(self, f): def setOutOfBand(self, f):
"""Define a call-back function for handling out-of-band communication """Define a call-back function for handling out-of-band communication
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment