Mercurial > kallithea
comparison rhodecode/lib/pidlock.py @ 1549:d6cb805c92fd beta
moved kill function to compat
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 11 Oct 2011 20:59:41 -0500 |
parents | 191f3f08236d |
children | 29e999f26998 |
comparison
equal
deleted
inserted
replaced
1548:cba42a9e9164 | 1549:d6cb805c92fd |
---|---|
4 import errno | 4 import errno |
5 | 5 |
6 from warnings import warn | 6 from warnings import warn |
7 from multiprocessing.util import Finalize | 7 from multiprocessing.util import Finalize |
8 | 8 |
9 from rhodecode import __platform__, PLATFORM_WIN | 9 from rhodecode.lib.compat import kill |
10 | |
11 if __platform__ in PLATFORM_WIN: | |
12 import ctypes | |
13 | |
14 def kill(pid, sig): | |
15 """kill function for Win32""" | |
16 kernel32 = ctypes.windll.kernel32 | |
17 handle = kernel32.OpenProcess(1, 0, pid) | |
18 return (0 != kernel32.TerminateProcess(handle, 0)) | |
19 | |
20 else: | |
21 kill = os.kill | |
22 | |
23 | 10 |
24 class LockHeld(Exception): | 11 class LockHeld(Exception): |
25 pass | 12 pass |
26 | 13 |
27 | 14 |