Revision e92376d7 lib/mcpu.py
b/lib/mcpu.py | ||
---|---|---|
131 | 131 |
adding_locks = level in lu.add_locks |
132 | 132 |
acquiring_locks = level in lu.needed_locks |
133 | 133 |
if level not in locking.LEVELS: |
134 |
if callable(self._run_notifier): |
|
135 |
self._run_notifier() |
|
134 | 136 |
result = self._ExecLU(lu) |
135 | 137 |
elif adding_locks and acquiring_locks: |
136 | 138 |
# We could both acquire and add locks at the same level, but for now we |
... | ... | |
170 | 172 |
|
171 | 173 |
return result |
172 | 174 |
|
173 |
def ExecOpCode(self, op, feedback_fn): |
|
175 |
def ExecOpCode(self, op, feedback_fn, run_notifier):
|
|
174 | 176 |
"""Execute an opcode. |
175 | 177 |
|
176 |
Args: |
|
177 |
op: the opcode to be executed |
|
178 |
@type op: an OpCode instance |
|
179 |
@param op: the opcode to be executed |
|
180 |
@type feedback_fn: a function that takes a single argument |
|
181 |
@param feedback_fn: this function will be used as feedback from the LU |
|
182 |
code to the end-user |
|
183 |
@type run_notifier: callable (no arguments) or None |
|
184 |
@param run_notifier: this function (if callable) will be called when |
|
185 |
we are about to call the lu's Exec() method, that |
|
186 |
is, after we have aquired all locks |
|
178 | 187 |
|
179 | 188 |
""" |
180 | 189 |
if not isinstance(op, opcodes.OpCode): |
... | ... | |
182 | 191 |
" to ExecOpcode") |
183 | 192 |
|
184 | 193 |
self._feedback_fn = feedback_fn |
194 |
self._run_notifier = run_notifier |
|
185 | 195 |
lu_class = self.DISPATCH_TABLE.get(op.__class__, None) |
186 | 196 |
if lu_class is None: |
187 | 197 |
raise errors.OpCodeUnknown("Unknown opcode") |
Also available in: Unified diff