Show More
@@ -36,6 +36,7 b' class lock(object):' | |||||
36 | self.releasefn = releasefn |
|
36 | self.releasefn = releasefn | |
37 | self.desc = desc |
|
37 | self.desc = desc | |
38 | self.postrelease = [] |
|
38 | self.postrelease = [] | |
|
39 | self.pid = os.getpid() | |||
39 | self.lock() |
|
40 | self.lock() | |
40 |
|
41 | |||
41 | def __del__(self): |
|
42 | def __del__(self): | |
@@ -71,7 +72,7 b' class lock(object):' | |||||
71 | return |
|
72 | return | |
72 | if lock._host is None: |
|
73 | if lock._host is None: | |
73 | lock._host = socket.gethostname() |
|
74 | lock._host = socket.gethostname() | |
74 |
lockname = '%s:%s' % (lock._host, |
|
75 | lockname = '%s:%s' % (lock._host, self.pid) | |
75 | while not self.held: |
|
76 | while not self.held: | |
76 | try: |
|
77 | try: | |
77 | util.makelock(lockname, self.f) |
|
78 | util.makelock(lockname, self.f) | |
@@ -133,6 +134,9 b' class lock(object):' | |||||
133 | self.held -= 1 |
|
134 | self.held -= 1 | |
134 | elif self.held == 1: |
|
135 | elif self.held == 1: | |
135 | self.held = 0 |
|
136 | self.held = 0 | |
|
137 | if os.getpid() != self.pid: | |||
|
138 | # we forked, and are not the parent | |||
|
139 | return | |||
136 | if self.releasefn: |
|
140 | if self.releasefn: | |
137 | self.releasefn() |
|
141 | self.releasefn() | |
138 | try: |
|
142 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now