Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
788f18d2
Commit
788f18d2
authored
Feb 07, 2016
by
4ast
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #351 from iovisor/iteritems
Fix python map.items() racing with bpf delete
parents
d366b0e0
efbc28c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+24
-0
No files found.
src/python/bcc/__init__.py
View file @
788f18d2
...
...
@@ -286,6 +286,30 @@ class BPF(object):
if
res
<
0
:
raise
KeyError
# override the MutableMapping's implementation of these since they
# don't handle KeyError nicely
def
itervalues
(
self
):
for
key
in
self
:
# a map entry may be deleted in between discovering the key and
# fetching the value, suppress such errors
try
:
yield
self
[
key
]
except
KeyError
:
pass
def
iteritems
(
self
):
for
key
in
self
:
try
:
yield
(
key
,
self
[
key
])
except
KeyError
:
pass
def
items
(
self
):
return
[
item
for
item
in
self
.
iteritems
()]
def
values
(
self
):
return
[
value
for
value
in
self
.
itervalues
()]
def
clear
(
self
):
# default clear uses popitem, which can race with the bpf prog
for
k
in
self
.
keys
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment