def __init__(self, obj): self.object = obj self.task = \ threads.control(self.object) self.wait_info = self.task.wait_info() # ToDo: Insert platform dep. code here. self.regs = sparc.register(self.object['Registers'])
def show(self, from_tty): print ' Name:', self.object_control.name() print ' Attr:', self.attr.to_string() if self.attr.test('semaphore-type', 'bin-sema') or \ self.attr.test('semaphore-type', 'simple-bin-sema'): core_mutex = self.object['Core_control']['mutex'] locked = core_mutex['lock'] == 0 if locked: s = 'locked' else: s = 'unlocked' print ' Lock:', s print ' Nesting:', core_mutex['nest_count'] print ' Blocked:', core_mutex['blocked_count'] print ' Holder:', holder = core_mutex['holder'] if holder and locked: holder = threads.control(holder.dereference()) print holder.brief() elif holder == 0 and locked: print 'locked but no holder' else: print 'unlocked' wait_queue = threads.queue(core_mutex['Wait_queue']) tasks = wait_queue.tasks() print ' Queue: len = %d, state = %s' % (len(tasks), wait_queue.state()) print ' Tasks:' print ' Name (c:current, r:real), (id)' for t in range(0, len(tasks)): print ' ', tasks[t].brief(), ' (%08x)' % (tasks[t].id()) else: print 'semaphore'
def holder(self): h = self.ctrl['holder'] if h: return threads.control(h) return None
def __init__(self, obj): self.reference = obj self.object = obj.dereference() self.task = threads.control(self.reference) self.wait_info = self.task.wait_info() self.regs = self.task.registers()