src/JavaMonitor.st
author hlopkmar
Tue, 22 Nov 2011 12:26:32 +0000
branchjk_new_structure
changeset 1148 15b6074a4841
parent 1146 e458dd16772e
child 1152 040cba55a7d2
permissions -rw-r--r--
deleted useless logging
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     1
"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     5
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     7
 license:
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     8
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
     9
 This software is furnished under a license and may be used
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    14
 hereby transferred.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    15
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    17
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    19
 obtaining a copy of this software and associated documentation
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    20
 files (the 'Software'), to deal in the Software without
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    21
 restriction, including without limitation the rights to use,
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    23
 copies of the Software, and to permit persons to whom the
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    24
 Software is furnished to do so, subject to the following
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    25
 conditions:
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    26
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    27
 The above copyright notice and this permission notice shall be
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    28
 included in all copies or substantial portions of the Software.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    29
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    38
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    40
     of one of the above copright owners.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    41
"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    42
"{ Package: 'stx:libjava' }"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    43
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    44
Object subclass:#JavaMonitor
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
    45
	instanceVariableNames:'owningProcess processesEntered monitorSema processesEnteredAccess
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
    46
		owningProcessAccess count countAccess waitingSema
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
    47
		processesWaitingAccess processesWaiting'
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    48
	classVariableNames:''
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    49
	poolDictionaries:''
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    50
	category:'Languages-Java-Support'
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    51
!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    52
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    53
!JavaMonitor class methodsFor:'documentation'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    54
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    55
copyright
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    56
"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    57
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    58
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    59
                            SWING Research Group, Czech Technical University in Prague
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    60
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    61
 Parts of the code written by Claus Gittinger are under following
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    62
 license:
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    63
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    64
 This software is furnished under a license and may be used
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    65
 only in accordance with the terms of that license and with the
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    66
 inclusion of the above copyright notice.   This software may not
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    67
 be provided or otherwise made available to, or used by, any
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    68
 other person.  No title to or ownership of the software is
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    69
 hereby transferred.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    70
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    71
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    72
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    73
 Permission is hereby granted, free of charge, to any person
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    74
 obtaining a copy of this software and associated documentation
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    75
 files (the 'Software'), to deal in the Software without
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    76
 restriction, including without limitation the rights to use,
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    77
 copy, modify, merge, publish, distribute, sublicense, and/or sell
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    78
 copies of the Software, and to permit persons to whom the
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    79
 Software is furnished to do so, subject to the following
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    80
 conditions:
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    81
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    82
 The above copyright notice and this permission notice shall be
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    83
 included in all copies or substantial portions of the Software.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    84
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    85
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    86
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    87
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    88
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    89
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    90
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    91
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    92
 OTHER DEALINGS IN THE SOFTWARE.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    93
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    94
 [1] Code written at SWING Research Group contain a signature
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    95
     of one of the above copright owners.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    96
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    97
"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    98
! !
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
    99
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   100
!JavaMonitor class methodsFor:'instance creation'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   101
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   102
new
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   103
^self basicNew initialize.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   104
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   105
    "Created: / 20-11-2011 / 14:30:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   106
! !
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   107
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   108
!JavaMonitor methodsFor:'accessing'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   109
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   110
activeProcess
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   111
    ^ Processor activeProcess
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   112
!
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   113
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   114
copyProcessesEntered
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   115
    ^ processesEntered copy.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   116
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   117
    "Created: / 20-11-2011 / 14:45:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   118
!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   119
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   120
processesEntered
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   121
    "dont do anything to me, access needs to be sync'd"
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   122
    ^ processesEntered.
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   123
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   124
    "Created: / 20-11-2011 / 13:22:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   125
! !
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   126
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   127
!JavaMonitor methodsFor:'atomic'!
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   128
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   129
addProcess: aProcess
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   130
    processesEnteredAccess critical: [processesEntered add: aProcess].
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   131
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   132
    "Created: / 20-11-2011 / 20:30:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   133
!
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   134
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   135
clearOwningProcess
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   136
    owningProcessAccess critical: [ owningProcess := nil ].
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   137
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   138
    "Created: / 20-11-2011 / 20:34:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   139
!
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   140
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   141
decrement
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   142
    "owning process released monitor, lets lower our counter so we know how many times
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   143
     do we have to release it"
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   144
    
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   145
    countAccess critical: [ count := count - 1 ].
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   146
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   147
    "Created: / 22-11-2011 / 10:49:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   148
!
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   149
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   150
increment
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   151
    "owning process entered monitor again (recursion ...), lets raise our counter so we know how many times
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   152
    do we have to release it"
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   153
    countAccess critical: [ count := count + 1 ].
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   154
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   155
    "Created: / 22-11-2011 / 10:49:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   156
!
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   157
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   158
owningProcess: aProcess
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   159
owningProcessAccess critical: [owningProcess := aProcess].
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   160
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   161
    "Created: / 20-11-2011 / 20:32:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   162
!
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   163
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   164
processesWaitingAdd: aProcess 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   165
    processesWaitingAccess 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   166
        critical: [ self assert: (processesWaiting includesKey: aProcess) not.processesWaiting at: aProcess put: count ].
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   167
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   168
    "Created: / 22-11-2011 / 11:57:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   169
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   170
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   171
processesWaitingRestore: aProcess 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   172
   processesWaitingAccess 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   173
   critical: [
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   174
   self assert: (processesWaiting includesKey: aProcess).
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   175
   self reinitCounter: (processesWaiting at: aProcess).   
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   176
   processesWaiting removeKey: aProcess
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   177
           ].
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   178
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   179
    "Created: / 22-11-2011 / 12:59:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   180
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   181
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   182
reinitCounter
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   183
    "owning process is different from previous, lets start counting from beginning"
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   184
    
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   185
    countAccess critical: [ count := 1 ].
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   186
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   187
    "Created: / 22-11-2011 / 10:51:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   188
!
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   189
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   190
reinitCounter: newCount 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   191
    countAccess critical: [ count := newCount ].
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   192
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   193
    "Created: / 22-11-2011 / 13:00:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   194
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   195
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   196
removeProcess: aProcess 
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   197
    processesEnteredAccess 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   198
        critical: [
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   199
            self assert: processesEntered last == aProcess.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   200
            processesEntered remove: aProcess
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   201
        ].
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   202
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   203
    "Created: / 20-11-2011 / 20:28:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   204
! !
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   205
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   206
!JavaMonitor methodsFor:'initialization'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   207
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   208
initialize
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   209
    owningProcess := nil.
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   210
    owningProcessAccess := Semaphore forMutualExclusion.
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   211
    processesEntered := OrderedCollection new.
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   212
    processesEnteredAccess := Semaphore forMutualExclusion.
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   213
    monitorSema := Semaphore new: 1.
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   214
    countAccess := Semaphore forMutualExclusion.
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   215
    processesWaiting := Dictionary new.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   216
    processesWaitingAccess := Semaphore forMutualExclusion.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   217
    waitingSema := Semaphore new: 0.
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   218
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   219
    "Created: / 20-11-2011 / 13:28:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   220
! !
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   221
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   222
!JavaMonitor methodsFor:'public'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   223
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   224
acquire
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   225
    | thisProcess |
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   226
    thisProcess := self activeProcess.
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   227
    (self isOwnedBy: thisProcess) ifTrue: [
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   228
        self increment.
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   229
        ^ self
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   230
    ].
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   231
    monitorSema wait.
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   232
    self owningProcess: thisProcess.
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   233
    self reinitCounter.
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   234
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   235
    "Created: / 20-11-2011 / 13:21:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   236
!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   237
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   238
enter
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   239
    | thisProcess |
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   240
    thisProcess := self activeProcess.
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   241
    self addProcess: thisProcess.
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   242
    self acquire.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   243
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   244
    "Created: / 20-11-2011 / 13:21:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   245
!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   246
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   247
exit
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   248
    | thisProcess |
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   249
    thisProcess := self activeProcess.
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   250
    (self isOwnedBy: thisProcess) ifTrue: [ self release. ].
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   251
    processesEntered remove: thisProcess.
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   252
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   253
    "Created: / 20-11-2011 / 13:21:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   254
!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   255
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   256
notify
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   257
    "wakeup one waiting process"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   258
    
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   259
    | thisProcess |
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   260
    thisProcess := Processor activeProcess.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   261
    self assert: (self isOwnedBy: thisProcess).        
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   262
    waitingSema signal.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   263
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   264
    "Created: / 22-11-2011 / 12:14:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   265
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   266
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   267
notifyAll
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   268
    "wakeup one waiting process"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   269
    
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   270
    | thisProcess |
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   271
    thisProcess := Processor activeProcess.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   272
    self assert: (self isOwnedBy: thisProcess).
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   273
    waitingSema signalForAll.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   274
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   275
    "Created: / 22-11-2011 / 12:14:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   276
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   277
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   278
release
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   279
    | thisProcess |
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   280
    thisProcess := self activeProcess.
1145
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   281
    self assert: (self isOwnedBy: owningProcess).
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   282
    count == 1 ifTrue: [
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   283
        self clearOwningProcess.
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   284
        monitorSema signal.
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   285
    ] ifFalse: [
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   286
        self decrement.       
8728f5373a48 end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents: 1144
diff changeset
   287
    ]
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   288
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   289
    "Created: / 20-11-2011 / 13:21:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   290
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   291
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   292
releaseAll
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   293
    count timesRepeat: [self release].
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   294
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   295
    "Created: / 22-11-2011 / 13:05:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   296
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   297
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   298
wait
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   299
    "make owning process to go to wait"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   300
    
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   301
    self waitForMilliseconds: nil.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   302
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   303
    "Created: / 22-11-2011 / 11:57:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   304
!
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   305
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   306
waitForMilliseconds: timeOut 
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   307
    "make owning process to go to wait, but not longer than timeout"
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   308
    
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   309
    | thisProcess |
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   310
    thisProcess := Processor activeProcess.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   311
    self assert: (self isOwnedBy: thisProcess).
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   312
    self processesWaitingAdd: thisProcess.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   313
    self releaseAll.
1148
15b6074a4841 deleted useless logging
hlopkmar
parents: 1146
diff changeset
   314
    waitingSema waitWithTimeoutMs: timeOut.    
1146
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   315
    self acquire.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   316
    self processesWaitingRestore: thisProcess.
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   317
e458dd16772e java monitors now know wait, notify, notifyall
hlopkmar
parents: 1145
diff changeset
   318
    "Created: / 22-11-2011 / 12:52:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   319
! !
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   320
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   321
!JavaMonitor methodsFor:'queries'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   322
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   323
isAcquired
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   324
    ^ owningProcessAccess critical: [owningProcess notNil].
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   325
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   326
    "Created: / 20-11-2011 / 13:22:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   327
!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   328
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   329
isOwnedBy: aProcess 
1143
5e1de8c6b43e JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents: 1142
diff changeset
   330
    ^ owningProcessAccess critical: [ owningProcess == aProcess ].
1142
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   331
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   332
    "Created: / 20-11-2011 / 13:23:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   333
! !
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   334
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   335
!JavaMonitor class methodsFor:'documentation'!
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   336
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   337
version_SVN
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   338
    ^ '$Id$'
1a1ce9fd0a16 java monitors (not plugged in yet)
hlopkmar
parents:
diff changeset
   339
! !