Commit Graph

5 Commits

Author SHA1 Message Date
Autumn
6647cbd63c REFAC(plugins): Specialize SharedMemory to LinkedMem
SharedMemory is only used to point to an instance of LinkedMem.
Preventing it from having a dynamic size simplifies the code.
2023-04-11 13:40:39 -07:00
Autumn
51c3e42648 FIX(plugins): Use atomic operations in Link plugin
The Link plugin uses an inherently racy protocol to communicate with
applications: shared memory with no means of synchronization. This
commit makes no changes to this protocol and shouldn't break anything
that was working before. That means it doesn't eliminate race
conditions, but it does allow the plugin to work without the risk of
*data races* specifically, which are undefined behavior.

This is done by using 32-bit atomic operations to copy the LinkedMem
struct out of shared memory before reading from it. This should work
well, since every field of LinkedMem has a size that's a multiple of
32 bits, and 32-bit atomics are widely supported.

With this change, applications can avoid data races with the Link
plugin by also accessing shared memory exclusively with 32-bit atomic
operations. Applications that already work with the plugin should
continue to work.
2023-04-11 13:40:06 -07:00
Robert Adam
249d2c6298 MAINT: Update copyright headers to 2023 2023-01-08 15:54:35 +01:00
Robert Adam
d100ff1467 MAINT: Update copyright to 2022 2022-01-04 20:17:33 +01:00
Robert Adam
e981827de5 MAINT: Add Link plugin tester
This commit adds a small CLI program that just connects to the Link
plugin and sends random positions to it. It is meant to be used as a
test-case for the Link plugin.
2021-11-18 19:25:28 +01:00