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