vault backup: 2025-04-02 23:20:03
This commit is contained in:
parent
c14ac3253c
commit
af2d7f19c7
2 changed files with 41 additions and 20 deletions
|
@ -1,3 +1,26 @@
|
|||
```
|
||||
barrier() :=
|
||||
GLOB_MUTEX and R_MUTEX semaphores init. at 1
|
||||
R a shared register init. at 0
|
||||
|
||||
begin_read() :=
|
||||
R_MUTEX.down()
|
||||
R++ # currently active readers
|
||||
if R = 1 then GLOB_MUTEX.down()
|
||||
R_MUTEX.up()
|
||||
return
|
||||
|
||||
end_read() :=
|
||||
R_MUTEX.down()
|
||||
R--
|
||||
if R = 0 then GLOB_MUTEX.up()
|
||||
R_MUTEX.up()
|
||||
return
|
||||
|
||||
begin_write() :=
|
||||
GLOB_MUTEX.down()
|
||||
return
|
||||
|
||||
end_write() :=
|
||||
GLOB_MUTEX.up()
|
||||
return
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue