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
aa7c1792
Commit
aa7c1792
authored
13 years ago
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved QueueListener implementation - queue sentinel addition made extensible.
parent
8f36af7a
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
Lib/logging/handlers.py
Lib/logging/handlers.py
+11
-1
No files found.
Lib/logging/handlers.py
View file @
aa7c1792
...
...
@@ -1307,6 +1307,16 @@ class QueueListener(object):
except
queue
.
Empty
:
break
def
enqueue_sentinel
(
self
):
"""
This is used to enqueue the sentinel record.
The base implementation uses put_nowait. You may want to override this
method if you want to use timeouts or work with custom queue
implementations.
"""
self
.
queue
.
put_nowait
(
self
.
_sentinel
)
def
stop
(
self
):
"""
Stop the listener.
...
...
@@ -1316,6 +1326,6 @@ class QueueListener(object):
may be some records still left on the queue, which won't be processed.
"""
self
.
_stop
.
set
()
self
.
queue
.
put_nowait
(
self
.
_sentinel
)
self
.
enqueue_sentinel
(
)
self
.
_thread
.
join
()
self
.
_thread
=
None
This diff is collapsed.
Click to expand it.
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