mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-27 04:50:28 +00:00
Add shared memory hit counter example to redbean
This commit is contained in:
parent
38e3ab57a6
commit
8aca94f951
6 changed files with 114 additions and 29 deletions
|
@ -4509,7 +4509,7 @@ UNIX MODULE
|
|||
end
|
||||
end
|
||||
function Unlock()
|
||||
old = mem:add(LOCK, -1)
|
||||
old = mem:fetch_add(LOCK, -1)
|
||||
if old == 2 then
|
||||
mem:store(LOCK, 0)
|
||||
mem:wake(LOCK, 1)
|
||||
|
@ -4568,7 +4568,7 @@ UNIX MODULE
|
|||
single lock which is used to synchronize reads and writes to
|
||||
that specific map. To make it scale, create additional maps.
|
||||
|
||||
unix.Memory:write(data:str[, offset:int[, bytes:int]])
|
||||
unix.Memory:write([offset:int,] data:str[, bytes:int]])
|
||||
|
||||
Writes bytes to memory region.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue