source: rtems-tools/tools/gdb/python/supercore.py @ 8e0de06

4.104.115
Last change on this file since 8e0de06 was 8e0de06, checked in by Dhananjay Balan <mb.dhananjay@…>, on 07/29/13 at 04:55:38

Add classic barrier.

  • Add support for classic barrier object.
  • Drop CORE_ from names in supercore
  • Property mode set to 100644
File size: 1.2 KB
Line 
1#
2# RTEMS Supercore Objects
3#
4
5import threads
6import helper
7
8class message_queue:
9    '''Manage a Supercore message_queue'''
10
11    def __init__(self, message_queue):
12        self.queue = message_queue
13        self.wait_queue = threads.queue(self.queue['Wait_queue'])
14        # ToDo: self.attribute =''
15        # self.buffer
16
17    def show(self):
18        helper.tasks_printer_routine(self.wait_queue)
19
20class barrier_attributes:
21    '''supercore bbarrier attribute'''
22
23    def __init__(self,attr):
24        self.attr = attr
25
26    def max_count(self):
27        c = self.attr['maximum_count']
28        return c
29
30    def discipline(self):
31        d = self.attr['discipline']
32        return d
33
34class barrier_control:
35    '''Manage a Supercore barrier'''
36
37    def __init__(self, barrier):
38        self.barrier = barrier
39        self.wait_queue = threads.queue(self.barrier['Wait_queue'])
40        self.attr = barrier_attributes(self.barrier['Attributes'])
41
42    def waiting_threads(self):
43        wt = self.barrier['number_of_waiting_threads']
44        return wt
45
46    def max_count(self):
47        return self.attr.max_count()
48
49    def discipline(self):
50        return self.attr.discipline()
51
52    def tasks(self):
53        return self.wait_queue
Note: See TracBrowser for help on using the repository browser.