mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Implement minetest.ipc_cas()
This commit is contained in:
parent
f1a436619f
commit
72801d0233
5 changed files with 68 additions and 8 deletions
|
@ -7066,6 +7066,18 @@ minetest.ipc_get("test:foo").subkey = "value" -- WRONG!
|
|||
minetest.ipc_get("test:foo") -- returns an empty table
|
||||
```
|
||||
|
||||
**Advanced**:
|
||||
|
||||
* `minetest.ipc_cas(key, old_value, new_value)`:
|
||||
* Write a value to the shared data area, but only if the previous value
|
||||
equals what was given.
|
||||
This operation is called Compare-and-Swap and can be used to implement
|
||||
synchronization between threads.
|
||||
* `key`: as above
|
||||
* `old_value`: value compared to using `==` (`nil` compares equal for non-existing keys)
|
||||
* `new_value`: value that will be set
|
||||
* returns: true on success, false otherwise
|
||||
|
||||
Bans
|
||||
----
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue