Document and test thread safety properties
Some checks reported errors
Tests / Clang total: 1096, passed: 1096
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc] total: 1096, passed: 1096
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 824, passed: 824
weaselab/conflict-set/pipeline/head Something is wrong with the build of this commit

Closes #2
This commit is contained in:
2024-03-19 16:27:24 -07:00
parent becfd25139
commit aa6f237d50
5 changed files with 99 additions and 27 deletions

View File

@@ -19,7 +19,15 @@ limitations under the License.
#include <stdint.h>
#ifdef __cplusplus
/** A data structure for optimistic concurrency control on ranges of
* bitwise-lexicographically-ordered keys.
*
* Thread safety:
* - It's safe to operate on two different ConflictSets in two different
* threads concurrently
* - It's safe to have multiple threads operating on the same ConflictSet
* concurrently if and only if all threads only call `check`.
*/
struct __attribute__((__visibility__("default"))) ConflictSet {
enum Result {
/** The result of a check which does not intersect any conflicting writes */
@@ -92,6 +100,15 @@ private:
#else
/** A data structure for optimistic concurrency control on ranges of
* bitwise-lexicographically-ordered keys.
*
* Thread safety:
* - It's safe to operate on two different ConflictSets in two different
* threads concurrently
* - It's safe to have multiple threads operating on the same ConflictSet
* concurrently if and only if all threads only call `check`.
*/
typedef struct ConflictSet ConflictSet;
typedef enum {