@@ -94,24 +94,29 @@ A <dfn export id=file>file entry</dfn> additionally consists of
94
94
a <dfn for="file entry">lock</dfn> (a string that may exclusively be "`open`", "`taken-exclusive`" or "`taken-shared`")
95
95
and a <dfn for="file entry">shared lock count</dfn> (a number representing the number shared locks that are taken at a given point in time).
96
96
97
+ The <dfn id="file-system-lock-queue">file system lock queue</dfn> is a
98
+ [=parallel queue=] to be used for all <a for=/>tasks</a> involving a
99
+ [=file entry/lock=] .
100
+
97
101
<div algorithm>
98
102
To <dfn for="file entry/lock">take</dfn> a [=file entry/lock=] with a |value| of "`exclusive`" or "`shared`" on a given [=file entry=] |file|:
99
103
100
104
1. Let |lock| be the |file|'s [=file entry/lock=] .
101
- 1. Let |count| be the |file|'s [=file entry/shared lock count=] .
102
- 1. If |value| is "`exclusive`":
103
- 1. If |lock| is "`open`":
104
- 1. Set lock to "`taken-exclusive`".
105
- 1. Return true.
106
- 1. If |value| is "`shared`":
107
- 1. If |lock| is "`open`":
108
- 1. Set |lock| to "`taken-shared`".
109
- 1. Set |count| to 1.
110
- 1. Return true.
111
- 1. Otherwise, if |lock| is "`taken-shared`":
112
- 1. Increase |count| by one.
113
- 1. Return true.
114
- 1. Return false.
105
+ 1. [=Enqueue the following steps=] to the [=file system lock queue=] :
106
+ 1. Let |count| be the |file|'s [=file entry/shared lock count=] .
107
+ 1. If |value| is "`exclusive`":
108
+ 1. If |lock| is "`open`":
109
+ 1. Set lock to "`taken-exclusive`".
110
+ 1. Return true.
111
+ 1. If |value| is "`shared`":
112
+ 1. If |lock| is "`open`":
113
+ 1. Set |lock| to "`taken-shared`".
114
+ 1. Set |count| to 1.
115
+ 1. Return true.
116
+ 1. Otherwise, if |lock| is "`taken-shared`":
117
+ 1. Increase |count| by one.
118
+ 1. Return true.
119
+ 1. Return false.
115
120
116
121
</div>
117
122
@@ -120,11 +125,12 @@ To <dfn for="file entry/lock">release</dfn> a [=file entry/lock=] on a given [=f
120
125
run these steps:
121
126
122
127
1. Let |lock| be the |file|'s associated [=file entry/lock=] .
123
- 1. Let |count| be the |file|'s [=file entry/shared lock count=] .
124
- 1. If |lock| is "`taken-shared`":
125
- 1. Decrease |count| by one.
126
- 1. If |count| is 0, set |lock| to "`open`".
127
- 1. Otherwise, set |lock| to "`open`".
128
+ 1. [=Enqueue the following steps=] to the [=file system lock queue=] :
129
+ 1. Let |count| be the |file|'s [=file entry/shared lock count=] .
130
+ 1. If |lock| is "`taken-shared`":
131
+ 1. Decrease |count| by one.
132
+ 1. If |count| is 0, set |lock| to "`open`".
133
+ 1. Otherwise, set |lock| to "`open`".
128
134
129
135
</div>
130
136
0 commit comments