Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
8918947d
Commit
8918947d
authored
Sep 13, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
osfs.watch_inotify: make background thread friendlier to interpreter shutdown
parent
547e5f54
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
fs/osfs/watch_inotify.py
+8
-2
No files found.
fs/osfs/watch_inotify.py
View file @
8918947d
...
@@ -43,6 +43,7 @@ class OSFSWatchMixin(WatchableFSMixin):
...
@@ -43,6 +43,7 @@ class OSFSWatchMixin(WatchableFSMixin):
wt
=
self
.
__watch_thread
wt
=
self
.
__watch_thread
if
wt
is
not
None
and
not
wt
.
watchers
:
if
wt
is
not
None
and
not
wt
.
watchers
:
wt
.
stop
()
wt
.
stop
()
wt
.
join
()
OSFSWatchMixin
.
__watch_thread
=
None
OSFSWatchMixin
.
__watch_thread
=
None
finally
:
finally
:
self
.
__watch_lock
.
release
()
self
.
__watch_lock
.
release
()
...
@@ -225,17 +226,22 @@ class SharedThreadedNotifier(threading.Thread):
...
@@ -225,17 +226,22 @@ class SharedThreadedNotifier(threading.Thread):
self
.
_poller
.
unregister
(
fd
)
self
.
_poller
.
unregister
(
fd
)
def
run
(
self
):
def
run
(
self
):
# Grab some attributes of the select module, so they're available
# even when shutting down the interpreter.
_select_error
=
select
.
error
_select_POLLIN
=
select
.
POLLIN
# Loop until stopped, dispatching to individual notifiers.
self
.
running
=
True
self
.
running
=
True
while
self
.
running
:
while
self
.
running
:
try
:
try
:
ready_fds
=
self
.
_poller
.
poll
()
ready_fds
=
self
.
_poller
.
poll
()
except
select
.
error
,
e
:
except
_select_
error
,
e
:
if
e
[
0
]
!=
errno
.
EINTR
:
if
e
[
0
]
!=
errno
.
EINTR
:
raise
raise
else
:
else
:
for
(
fd
,
event
)
in
ready_fds
:
for
(
fd
,
event
)
in
ready_fds
:
# Ignore all events other than "input ready".
# Ignore all events other than "input ready".
if
not
event
&
select
.
POLLIN
:
if
not
event
&
_select_
POLLIN
:
continue
continue
# For signals on our internal pipe, just read and discard.
# For signals on our internal pipe, just read and discard.
if
fd
==
self
.
_pipe_r
:
if
fd
==
self
.
_pipe_r
:
...
...
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