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