Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c1bc654c
Commit
c1bc654c
authored
Jan 09, 2012
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve clarity with keyword argument for block. Move nowait methods together.
parent
b6ace028
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
Lib/queue.py
Lib/queue.py
+9
-9
No files found.
Lib/queue.py
View file @
c1bc654c
...
...
@@ -145,14 +145,6 @@ class Queue:
self
.
unfinished_tasks
+=
1
self
.
not_empty
.
notify
()
def
put_nowait
(
self
,
item
):
"""Put an item into the queue without blocking.
Only enqueue the item if a free slot is immediately available.
Otherwise raise the Full exception.
"""
return
self
.
put
(
item
,
False
)
def
get
(
self
,
block
=
True
,
timeout
=
None
):
"""Remove and return an item from the queue.
...
...
@@ -184,13 +176,21 @@ class Queue:
self
.
not_full
.
notify
()
return
item
def
put_nowait
(
self
,
item
):
"""Put an item into the queue without blocking.
Only enqueue the item if a free slot is immediately available.
Otherwise raise the Full exception.
"""
return
self
.
put
(
item
,
block
=
False
)
def
get_nowait
(
self
):
"""Remove and return an item from the queue without blocking.
Only get an item if one is immediately available. Otherwise
raise the Empty exception.
"""
return
self
.
get
(
False
)
return
self
.
get
(
block
=
False
)
# Override these methods to implement other queue organizations
# (e.g. stack or priority queue).
...
...
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