SemaphoreMonitor.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 19 Jul 2017 09:42:32 +0200
branchjv
changeset 17619 edb119820fcb
parent 17277 11e4a5ca80a5
permissions -rw-r--r--
Issue #154: Set window style using `#beToolWindow` to indicate that the minirunner window is kind of support tool rather than some X11 specific code (which does not work on Windows of course) See https://swing.fit.cvut.cz/projects/stx-jv/ticket/154
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by Claus Gittinger
14202
336beb9d98f6 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 12399
diff changeset
     3
	      All Rights Reserved
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
4253
fb44beaa9aa1 menu labels
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
    12
"{ Package: 'stx:libtool' }"
fb44beaa9aa1 menu labels
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
    13
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    14
"{ NameSpace: Smalltalk }"
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    15
982
ed5de0e2fb24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
    16
SystemStatusMonitor subclass:#SemaphoreMonitor
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'semaphores'
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
1053
9b1b15ef1e34 category change
Claus Gittinger <cg@exept.de>
parents: 1052
diff changeset
    20
	category:'Monitors-ST/X'
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!SemaphoreMonitor class methodsFor:'documentation'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 1997 by Claus Gittinger
14202
336beb9d98f6 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 12399
diff changeset
    28
	      All Rights Reserved
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    43
    This view shows smalltalk's semaphores - a debugging tool.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    45
    [disclaimer:]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    46
        this is one of the oldest tools in the system, written in the early 90's.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    47
        It does in no way reflect the way GUIs are designed/written these days.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    48
        
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [see also:]
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    50
        Semaphore SemaphoreSet
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    51
        Process ProcessorScheduler
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    52
        WindowGroup
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    53
        ProcessMonitor
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    [author:]
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    56
        Claus Gittinger
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    [start with:]
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
    59
        SemaphoreMonitor open
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
! !
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
!SemaphoreMonitor class methodsFor:'defaults'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
defaultLabel
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    ^ 'Semaphore Monitor'
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    "Created: 23.1.1997 / 02:52:53 / cg"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
! !
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
!SemaphoreMonitor methodsFor:'drawing'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
titleLine
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    74
    ^ 'Id     Name                    Count  Owner   Waiting Process(es)'.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    "
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
     SemaphoreMonitor open
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    "
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
    80
    "Modified: / 17.6.1998 / 14:52:48 / cg"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
updateList
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    "update list of semaphores"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    |newList|
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    shown ifTrue:[
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    89
        newList := Semaphore allSubInstances.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    91
        "sort by hashKey - will not always generate unique numbers,
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    92
         but most of the time, this works ... for now"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    94
        newList sort:[:s1 :s2 | s1 identityHash < s2 identityHash].
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    95
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    96
        newList ~= semaphores ifTrue:[
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    97
            self updateStatus:newList
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
    98
        ].
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    ].
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   100
    self installDelayedUpdate.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
2487
4ac80975b91d avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
   102
    "Modified: / 3.7.1996 / 13:37:29 / stefan"
4ac80975b91d avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
   103
    "Created: / 23.1.1997 / 02:44:48 / cg"
4ac80975b91d avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
   104
    "Modified: / 14.12.1999 / 20:52:44 / cg"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
2487
4ac80975b91d avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
   107
updateStatus:newSemaphoreList
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    "update status display of semaphores"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   110
    |oldList list oldSelection newSelection|
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    shown ifTrue:[
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   113
        oldList := listView list.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   114
        oldSelection := listView selectionValue.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   115
        oldSelection notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   116
            oldSelection := oldSelection collect:[:line | line asCollectionOfWords first asNumber].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   117
            newSelection := OrderedCollection new.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   118
        ].
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   120
        newSemaphoreList notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   121
            semaphores := WeakArray withAll:newSemaphoreList.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   122
        ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   123
        semaphores notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   124
            list := OrderedCollection new:(semaphores size + self numberOfHeadlines).
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   125
            list add:self titleLine.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   126
            list add:(String new:self titleLine size withAll:$-).
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   128
            semaphores validElementsDo:[:aSemaphore |
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   129
                |waiters waitersNames nm id str owner color line count|
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   131
                "/ need a copy - it may change while being enumerated
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   132
                [
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   133
                    count := aSemaphore count.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   134
                    waiters := aSemaphore waitingProcesses copy.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   135
                ] valueUninterruptably.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   137
                str := '' writeStream.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   138
                [
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   139
                    waiters notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   140
                        waiters do:[:aProcess |
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   141
                            str nextPut:$[.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   142
                            aProcess id printOn:str.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   143
                            str nextPutAll:' '''.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   144
                            str nextPutAll:(aProcess name contractTo:40).
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   145
                            str nextPutAll:'''<'.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   146
                            aProcess priority printOn:str.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   147
                            str nextPutAll:'>]'.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   148
                            str space.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   149
                        ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   150
                    ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   151
                ] valueUninterruptably.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   152
                waitersNames := str contents.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   154
                (aSemaphore respondsTo:#name) ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   155
                    nm := aSemaphore name.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   156
                    nm isNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   157
                        nm := ''
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   158
                    ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   159
                ] ifFalse:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   160
                    nm := ''
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   161
                ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   162
                id := aSemaphore identityHash bitShift:-12.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   163
                owner := aSemaphore lastOwnerId.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   164
                owner isNil ifTrue:[
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   165
                    owner := ''
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   166
                ] ifFalse:[
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   167
                    owner := owner printString
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   168
                ].
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   169
                owner := owner leftPaddedTo:6.
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   170
                
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   171
                line := (id printStringPaddedTo:6)
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   172
                          , ' '
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   173
                          , ((nm contractTo:25) paddedTo:25)
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   174
                          , ' '
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   175
                          , (count printStringLeftPaddedTo:3)
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   176
                          , ' '
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   177
                          , owner printString
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   178
                          , ' '
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   179
                          , (waiters size printStringLeftPaddedTo:3)
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   180
                          , ' '
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   181
                          , waitersNames.
12399
8de7c5d4d740 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 4253
diff changeset
   182
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   183
                count > 0 ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   184
                    waiters size > 0 ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   185
                        "this happens if a low priority process is ready to run but didn't wake up yet"
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   186
                        color := Color red.
12399
8de7c5d4d740 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 4253
diff changeset
   187
"/                        self beep.
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   188
                    ] ifFalse:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   189
                        "fine, this semaphore is available"
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   190
                        color := Color blue.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   191
                    ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   192
                    line := line colorizeAllWith:color.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   193
                ] ifFalse:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   194
                    waiters size > 0 ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   195
                        line := line colorizeAllWith:Color brown.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   196
                    ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   197
                ].
14202
336beb9d98f6 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 12399
diff changeset
   198
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   199
                list add:line.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   200
                oldSelection notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   201
                    (oldSelection includes:id) ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   202
                        newSelection add:list size.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   203
                    ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   204
                ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   205
            ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   206
        ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   207
        "avoid flicker"
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   208
        (oldList notNil and:[oldList size == list size]) ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   209
            list keysAndValuesDo:[:idx :entry |
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   210
                (oldList at:idx) ~= entry ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   211
                    listView at:idx put:entry
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   212
                ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   213
            ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   214
        ] ifFalse:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   215
            listView setList:list.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   216
            "the first two entries cannot be selected"
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   217
            listView attributeAt:1 put:#disabled.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   218
            listView attributeAt:2 put:#disabled.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   219
        ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   220
        newSelection notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   221
            listView selectWithoutScroll:newSelection
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   222
        ].
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   223
        listView flush
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    ].
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   225
    self installDelayedUpdate.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   227
    "Modified: / 3.7.1996 / 13:56:01 / stefan"
2487
4ac80975b91d avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
   228
    "Created: / 14.12.1999 / 20:52:29 / cg"
4ac80975b91d avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
   229
    "Modified: / 14.12.1999 / 20:53:14 / cg"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
! !
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
!SemaphoreMonitor methodsFor:'menu'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   234
debugLastOwningProcess
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   235
    "open a debugger on the selected semaphores' (last) owning processes"
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   236
14202
336beb9d98f6 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 12399
diff changeset
   237
    self selectedSemaphoresDo:[:aSema |
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   238
        |p|
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   239
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   240
        (p := aSema lastOwner) notNil ifTrue:[
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   241
            DebugView openOn:p
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   242
        ]
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   243
    ]
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   244
!
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   245
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   246
debugWaiters
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   247
    "open a debugger on the selected semaphores' waiting processes"
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   248
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   249
    self selectedSemaphoresDo:[:aSema |
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   250
        aSema waitingProcesses do:[:aProcess |
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   251
            DebugView openOn:aProcess
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   252
        ]
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   253
    ]
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   254
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   255
    "Modified: / 23.1.1997 / 03:12:06 / cg"
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   256
    "Created: / 17.6.1998 / 14:56:55 / cg"
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   257
!
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   258
995
5dcfea360374 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   259
inspectSemaphore
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   260
    "open an inspector on the selected semaphore(s)"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    self selectedSemaphoresDo:[:aSema | aSema inspect]
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    "Modified: 23.1.1997 / 03:12:06 / cg"
995
5dcfea360374 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   265
    "Created: 24.1.1997 / 23:11:50 / cg"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   268
inspectWaiters
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   269
    "open an inspector on the selected semaphores' waiting processes"
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   270
14202
336beb9d98f6 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 12399
diff changeset
   271
    self selectedSemaphoresDo:[:aSema |
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   272
        aSema waitingProcesses do:[:aProcess |
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   273
            aProcess inspect
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   274
        ]
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   275
    ]
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   276
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   277
    "Modified: / 23.1.1997 / 03:12:06 / cg"
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   278
    "Created: / 17.6.1998 / 14:17:41 / cg"
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   279
!
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   280
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
selectedSemaphoresDo:aBlock
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   282
    "evaluate aBlock on all selected semaphore(s)"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   284
    self selectionIndicesDo:[:n |
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   285
        |nr p|
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   286
        
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   287
        nr := n - self numberOfHeadlines.
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   288
        nr notNil ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   289
            nr > 0 ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   290
                p := semaphores at:nr.
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   291
                (p notNil and:[p ~~ 0]) ifTrue:[
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   292
                   aBlock value:p
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   293
                ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   294
            ]
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   295
        ]
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    ].
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
signalSemaphore
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
    "signal all selected semaphores"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    self selectedSemaphoresDo:[:aSema | aSema signal]
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
    "Created: 23.1.1997 / 03:12:30 / cg"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
statusMenu
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    "return a popUpMenu"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   310
    <resource: #programMenu>
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   311
4253
fb44beaa9aa1 menu labels
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   312
    |labels selectors m|
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
    labels := resources array:#(
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   315
                         'Inspect'
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   316
                         'Inspect Waiters'
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   317
                         'Debug Waiters'
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   318
                         'Debug Last Owning Process'
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   319
                         '-'
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   320
                         'Signal'
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   321
                        ).
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    selectors := #(
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   323
                         inspectSemaphore
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   324
                         inspectWaiters
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   325
                         debugWaiters
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   326
                         debugLastOwningProcess
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   327
                         nil
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   328
                         signalSemaphore
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   329
                        ).
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    updateProcess isNil ifTrue:[
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   332
        labels := (resources array:#('Update' '-')) , labels.
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   333
        selectors := #(updateView nil) , selectors
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    ].
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
    m := PopUpMenu labels:labels
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   337
                   selectors:selectors.
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
    listView hasSelection ifFalse:[
17226
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   341
        m disableAll:#(
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   342
                         inspectSemaphore
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   343
                         inspectWaiters
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   344
                         debugWaiters
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   345
                         debugLastOwningProcess
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   346
                         signalSemaphore
66b523a67429 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 17169
diff changeset
   347
                      )
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    ].
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
    ^ m
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
1692
1e2436b73ccc preserve selection;
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   351
    "Modified: / 17.6.1998 / 14:17:05 / cg"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
! !
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
!SemaphoreMonitor methodsFor:'queries'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   356
numberOfHeadlines
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   357
    ^ 2
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
! !
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
!SemaphoreMonitor methodsFor:'user actions'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
doubleClicked
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
    "open an inspector on the selected semaphore"
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
1023
975ef65be46c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   365
    self inspectSemaphore
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
    "Created: 23.1.1997 / 03:22:04 / cg"
1023
975ef65be46c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   368
    "Modified: 31.1.1997 / 22:33:27 / cg"
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
! !
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
!SemaphoreMonitor class methodsFor:'documentation'!
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
version
17169
91a80ba50915 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 14202
diff changeset
   374
    ^ '$Header$'
980
f0f5b1c4007e intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
! !
12399
8de7c5d4d740 class: SemaphoreMonitor
Stefan Vogel <sv@exept.de>
parents: 4253
diff changeset
   376