Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
3d4ca69f
Commit
3d4ca69f
authored
9 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python: wait until search completion for blocking get
parent
948a617d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/opendht.pyx
+6
-2
6 additions, 2 deletions
python/opendht.pyx
with
6 additions
and
2 deletions
python/opendht.pyx
+
6
−
2
View file @
3d4ca69f
...
...
@@ -277,15 +277,19 @@ cdef class DhtRunner(_WithID):
else
:
lock
=
threading
.
Condition
()
pending
=
0
res
=
[]
def
tmp_get
(
v
):
nonlocal
res
res
.
append
(
v
)
return
True
def
tmp_done
(
ok
,
nodes
):
nonlocal
pending
,
lock
with
lock
:
pending
-=
1
lock
.
notify
()
res
=
[]
with
lock
:
pending
+=
1
self
.
get
(
key
,
get_cb
=
lambda
v
:
res
.
append
(
v
)
,
done_cb
=
tmp_done
)
self
.
get
(
key
,
get_cb
=
tmp_get
,
done_cb
=
tmp_done
)
while
pending
>
0
:
lock
.
wait
()
return
res
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment