Skip to content
Browse files

Context: Explicit deadlock exception on diverge

  • Loading branch information...
1 parent 415ef9a commit 291bff8dcc4d0162a55d4aba871aec27b82fb262 @orenl orenl committed Jun 8, 2011
Showing with 18 additions and 8 deletions.
  1. +17 −8 src/scribe/context.pxi
  2. +1 −0 src/scribe/linux.pxd
View
25 src/scribe/context.pxi
@@ -201,7 +201,8 @@ class DivergeError(Exception):
strs.append(" %s" % line)
return '\n'.join(strs)
-
+class DeadlockError(DivergeError):
+ pass
cdef class Context:
cdef scribe_api.scribe_context_t _ctx
@@ -297,13 +298,21 @@ cdef class Context:
ps = subprocess.Popen('dmesg', stdout=subprocess.PIPE)
(dmesg, _) = ps.communicate()
dmesg = dmesg.decode()
- raise DivergeError(err = _errno,
- event = self.diverge_event,
- logfile = self.logfile,
- backtrace_offsets = self.log_offsets,
- backtrace_all_pids = self.backtrace_all_pids,
- backtrace_num_last_events = self.backtrace_num_last_events,
- additional_trace = dmesg)
+
+ args = {'err': _errno,
+ 'event': self.diverge_event,
+ 'logfile': self.logfile,
+ 'backtrace_offsets': self.log_offsets,
+ 'backtrace_all_pids': self.backtrace_all_pids,
+ 'backtrace_num_last_events': self.backtrace_num_last_events,
+ 'additional_trace': dmesg
+ }
+
+ if _errno == EDEADLK:
+ raise DeadlockError(**args)
+ else:
+ raise DivergeError(**args)
+
raise OSError(_errno, os.strerror(_errno))
def stop(self):
View
1 src/scribe/linux.pxd
@@ -1,5 +1,6 @@
cdef extern from "errno.h":
enum: EINTR
+ enum: EDEADLK
cdef extern from "linux/types.h":
ctypedef long long loff_t

0 comments on commit 291bff8

Please sign in to comment.
Something went wrong with that request. Please try again.