Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 772d696

Browse files
committed
__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.
1 parent 959fa01 commit 772d696

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

Tools/audiopy/audiopy

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ from SUNAUDIODEV import *
5454
# Milliseconds between interrupt checks
5555
KEEPALIVE_TIMER = 500
5656

57-
__version__ = '1.0'
57+
__version__ = '1.1'
5858

5959

6060

@@ -278,10 +278,19 @@ Email: [email protected]''' % __version__)
278278
self.__update()
279279

280280
def __update(self, num=None, frame=None):
281-
# We have to poll because the device could have changed state and the
282-
# underlying module does not support the SIGPOLL notification
283-
# interface.
284-
info = self.__devctl.getinfo()
281+
# It's possible (although I have never seen it) to get an interrupted
282+
# system call during the getinfo() call. If so, and we're polling,
283+
# don't sweat it because we'll come around again later. Otherwise,
284+
# we'll give it a couple of tries and then give up until next time.
285+
tries = 0
286+
while 1:
287+
try:
288+
info = self.__devctl.getinfo()
289+
break
290+
except sunaudiodev.error:
291+
if self.__needtopoll or tries > 3:
292+
return
293+
tries = tries + 1
285294
# input
286295
self.__inputvar.set(info.i_port)
287296
# output

0 commit comments

Comments
 (0)