summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-08-18 20:17:42 (GMT)
committerBarry Warsaw <barry@python.org>1999-08-18 20:17:42 (GMT)
commit772d69676eba256d9b2706152114ffe243abf8b6 (patch)
treea94761d6bbc753cdd077971f5e756fd2c0446206
parent959fa01dc38498992894e83e3d3dbe3839f3df02 (diff)
downloadcpython-772d69676eba256d9b2706152114ffe243abf8b6.zip
cpython-772d69676eba256d9b2706152114ffe243abf8b6.tar.gz
cpython-772d69676eba256d9b2706152114ffe243abf8b6.tar.bz2
__update(): Jeremy Hylton reports occurances of sunaudiodev.error
(interrupted system call) when getting the device information. I've never seen it, but this patch should take care of the problem. If we get that exception and we're polling, just return since we'll wake up again soon and get the right information. If we're not polling, try 4 times and then give up.
-rwxr-xr-xTools/audiopy/audiopy19
1 files changed, 14 insertions, 5 deletions
diff --git a/Tools/audiopy/audiopy b/Tools/audiopy/audiopy
index 1d6a641..19d69fd 100755
--- a/Tools/audiopy/audiopy
+++ b/Tools/audiopy/audiopy
@@ -54,7 +54,7 @@ from SUNAUDIODEV import *
# Milliseconds between interrupt checks
KEEPALIVE_TIMER = 500
-__version__ = '1.0'
+__version__ = '1.1'
@@ -278,10 +278,19 @@ Email: bwarsaw@python.org''' % __version__)
self.__update()
def __update(self, num=None, frame=None):
- # We have to poll because the device could have changed state and the
- # underlying module does not support the SIGPOLL notification
- # interface.
- info = self.__devctl.getinfo()
+ # It's possible (although I have never seen it) to get an interrupted
+ # system call during the getinfo() call. If so, and we're polling,
+ # don't sweat it because we'll come around again later. Otherwise,
+ # we'll give it a couple of tries and then give up until next time.
+ tries = 0
+ while 1:
+ try:
+ info = self.__devctl.getinfo()
+ break
+ except sunaudiodev.error:
+ if self.__needtopoll or tries > 3:
+ return
+ tries = tries + 1
# input
self.__inputvar.set(info.i_port)
# output