Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53e5fb3

Browse files
committed
An attempt to help the threaded reading to not show spurious errors anymore.
It does not necessarily seem to work, but at least we don't access adict concurrently anymore.
1 parentaa1b156 commit53e5fb3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎git/cmd.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def read_line_slow(stream):
7777
returnline
7878
# end
7979

80-
defdispatch_line(fno):
81-
stream,handler,readline=fdmap[fno]
80+
defdispatch_line(stream,handler,readline):
8281
# this can possibly block for a while, but since we wake-up with at least one or more lines to handle,
8382
# we are good ...
8483
line=readline(stream).decode(defenc)
@@ -93,9 +92,9 @@ def dispatch_line(fno):
9392
# end dispatch helper
9493
# end
9594

96-
defdeplete_buffer(fno,wg=None):
95+
defdeplete_buffer(stream,handler,readline,wg=None):
9796
whileTrue:
98-
line=dispatch_line(fno)
97+
line=dispatch_line(stream,handler,readline)
9998
ifnotline:
10099
break
101100
# end deplete buffer
@@ -124,7 +123,7 @@ def deplete_buffer(fno, wg=None):
124123
ifresult&CLOSED:
125124
closed_streams.add(fd)
126125
else:
127-
dispatch_line(fd)
126+
dispatch_line(*fdmap[fd])
128127
# end handle closed stream
129128
# end for each poll-result tuple
130129

@@ -134,8 +133,8 @@ def deplete_buffer(fno, wg=None):
134133
# end endless loop
135134

136135
# Depelete all remaining buffers
137-
forfnoinfdmap.keys():
138-
deplete_buffer(fno)
136+
forstream,handler,readlineinfdmap.values():
137+
deplete_buffer(stream,handler,readline)
139138
# end for each file handle
140139
else:
141140
# Oh ... probably we are on windows. select.select() can only handle sockets, we have files
@@ -145,7 +144,8 @@ def deplete_buffer(fno, wg=None):
145144
wg=WaitGroup()
146145
forfnoinfdmap.keys():
147146
wg.add(1)
148-
t=threading.Thread(target=lambda:deplete_buffer(fno,wg))
147+
stream,handler,readline=fdmap[fno]
148+
t=threading.Thread(target=lambda:deplete_buffer(stream,handler,readline,wg))
149149
t.start()
150150
# end
151151
# NOTE: Just joining threads can possibly fail as there is a gap between .start() and when it's

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp