equal
deleted
inserted
replaced
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 |
13 |
14 Object subclass:#RecursionLock |
14 Object subclass:#RecursionLock |
15 instanceVariableNames:'process sema' |
15 instanceVariableNames:'process sema' |
16 classVariableNames:'' |
16 classVariableNames:'' |
17 poolDictionaries:'' |
17 poolDictionaries:'' |
18 category:'Kernel-Processes' |
18 category:'Kernel-Processes' |
19 ! |
19 ! |
20 |
20 |
21 !RecursionLock class methodsFor:'documentation'! |
21 !RecursionLock class methodsFor:'documentation'! |
22 |
22 |
23 copyright |
23 copyright |
42 I.e. allows reentering the critical region if the current process |
42 I.e. allows reentering the critical region if the current process |
43 is the one which did the original locking. |
43 is the one which did the original locking. |
44 |
44 |
45 example: |
45 example: |
46 |
46 |
47 |lock| |
47 |lock| |
48 |
48 |
49 lock := RecursionLock new. |
49 lock := RecursionLock new. |
50 lock critical:[ |
50 lock critical:[ |
51 Transcript showCr:'in lock ...'. |
51 Transcript showCr:'in lock ...'. |
52 lock critical:[ |
52 lock critical:[ |
53 Transcript showCr:'again ...' |
53 Transcript showCr:'again ...' |
54 ] |
54 ] |
55 ] |
55 ] |
|
56 |
|
57 in contrast to (wrong example): |
|
58 |
|
59 |lock| |
|
60 |
|
61 lock := Semaphore forMutualExclusion. |
|
62 lock critical:[ |
|
63 Transcript showCr:'in lock ...'. |
|
64 lock critical:[ |
|
65 '*** never reached - deadlock because sema is already locked ***'. |
|
66 ' (press CTRL-c and abort in the debugger)'. |
|
67 Transcript showCr:'again ...' |
|
68 ] |
|
69 ] |
56 " |
70 " |
57 |
|
58 ! ! |
71 ! ! |
59 |
72 |
60 !RecursionLock class methodsFor:'instance creation'! |
73 !RecursionLock class methodsFor:'instance creation'! |
61 |
74 |
62 new |
75 new |
94 ! ! |
107 ! ! |
95 |
108 |
96 !RecursionLock class methodsFor:'documentation'! |
109 !RecursionLock class methodsFor:'documentation'! |
97 |
110 |
98 version |
111 version |
99 ^ '$Header: /cvs/stx/stx/libbasic/RecursionLock.st,v 1.6 1995-12-07 21:30:23 cg Exp $' |
112 ^ '$Header: /cvs/stx/stx/libbasic/RecursionLock.st,v 1.7 1995-12-16 13:01:20 cg Exp $' |
100 ! ! |
113 ! ! |