Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: commit-queue/sig_handler.py

Issue 135363007: Delete public commit queue to avoid confusion after move to internal repo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « commit-queue/projects.py ('k') | commit-queue/subversion_config/config » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging as _logging
6 import signal as _signal
7 import threading as _threading
8
9 _OK_HANDLERS = set((
10 _signal.SIG_DFL,
11 _signal.SIG_IGN,
12 _signal.default_int_handler,
13 ))
14
15 # Only manipulated on the main thread, so it doesn't need a lock.
16 _PREV_HANDLERS = {}
17
18 _SET_SIGNALS_LOCK = _threading.Lock()
19 _SET_SIGNALS = set()
20
21
22 def _handler(signal_num, _):
23 with _SET_SIGNALS_LOCK:
24 _SET_SIGNALS.add(signal_num)
25 _signal.signal(signal_num, _PREV_HANDLERS[signal_num])
26 _logging.warn(
27 '\n'
28 'commit-queue will exit at the end of this processing loop.\n'
29 'Hit Ctrl-C again to exit immediately.'
30 )
31
32
33 def getTriggeredSignals():
34 with _SET_SIGNALS_LOCK:
35 return _SET_SIGNALS.copy()
36
37
38 def installHandlers(*signal_numbers):
39 for signal_num in signal_numbers:
40 cur_handler = _signal.getsignal(signal_num)
41 if cur_handler == _handler:
42 continue
43
44 assert cur_handler in _OK_HANDLERS, \
45 'A signal handler is already installed for signal %d' % signal_num
46
47 _PREV_HANDLERS[signal_num] = cur_handler
48 _signal.signal(signal_num, _handler)
OLDNEW
« no previous file with comments | « commit-queue/projects.py ('k') | commit-queue/subversion_config/config » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698