vault backup: 2025-04-03 18:26:35
This commit is contained in:
parent
05b428be81
commit
1315545918
1 changed files with 11 additions and 1 deletions
|
@ -57,9 +57,11 @@ operation begin_write() :=
|
||||||
CW.signal() # wakes eventually other waiting writers *they will return false*
|
CW.signal() # wakes eventually other waiting writers *they will return false*
|
||||||
if (AR + AW != 0) then
|
if (AR + AW != 0) then
|
||||||
CW.wait()
|
CW.wait()
|
||||||
if LASTW
|
if (LASTW != i) then
|
||||||
|
return false
|
||||||
AW++
|
AW++
|
||||||
WW--
|
WW--
|
||||||
|
return true
|
||||||
|
|
||||||
operation end_write() :=
|
operation end_write() :=
|
||||||
AW--
|
AW--
|
||||||
|
@ -68,3 +70,11 @@ operation end_write() :=
|
||||||
else
|
else
|
||||||
CR.signal()
|
CR.signal()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
CNT initalized to the value I want to initalize the semaphore
|
||||||
|
|
||||||
|
up() :=
|
||||||
|
if CNT < 0 then
|
||||||
|
|
||||||
|
```
|
Loading…
Add table
Add a link
Reference in a new issue