Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit 5714129

Browse filesBrowse files
committed
tabs to spaces
1 parent 039c1d5 commit 5714129
Copy full SHA for 5714129

18 files changed

+2627
-2627
lines changed

‎async/__init__.py

Copy file name to clipboardExpand all lines: async/__init__.py
+25-25Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@
66

77
#{ Initialization
88
def _init_atexit():
9-
"""Setup an at-exit job to be sure our workers are shutdown correctly before
10-
the interpreter quits"""
11-
import atexit
12-
import thread
13-
atexit.register(thread.do_terminate_threads)
14-
9+
"""Setup an at-exit job to be sure our workers are shutdown correctly before
10+
the interpreter quits"""
11+
import atexit
12+
import thread
13+
atexit.register(thread.do_terminate_threads)
14+
1515
def _init_signals():
16-
"""Assure we shutdown our threads correctly when being interrupted"""
17-
import signal
18-
import thread
19-
import sys
20-
21-
prev_handler = signal.getsignal(signal.SIGINT)
22-
def thread_interrupt_handler(signum, frame):
23-
thread.do_terminate_threads()
24-
if callable(prev_handler):
25-
prev_handler(signum, frame)
26-
raise KeyboardInterrupt()
27-
# END call previous handler
28-
# END signal handler
29-
try:
30-
signal.signal(signal.SIGINT, thread_interrupt_handler)
31-
except ValueError:
32-
# happens if we don't try it from the main thread
33-
print >> sys.stderr, "Failed to setup thread-interrupt handler. This is usually not critical"
34-
# END exception handling
16+
"""Assure we shutdown our threads correctly when being interrupted"""
17+
import signal
18+
import thread
19+
import sys
20+
21+
prev_handler = signal.getsignal(signal.SIGINT)
22+
def thread_interrupt_handler(signum, frame):
23+
thread.do_terminate_threads()
24+
if callable(prev_handler):
25+
prev_handler(signum, frame)
26+
raise KeyboardInterrupt()
27+
# END call previous handler
28+
# END signal handler
29+
try:
30+
signal.signal(signal.SIGINT, thread_interrupt_handler)
31+
except ValueError:
32+
# happens if we don't try it from the main thread
33+
print >> sys.stderr, "Failed to setup thread-interrupt handler. This is usually not critical"
34+
# END exception handling
3535

3636

3737
#} END init

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.