contur2
Loading...
Searching...
No Matches
i_sync_primitive.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <string_view>
7
8#include "contur/core/error.h"
9#include "contur/core/types.h"
10
11namespace contur {
12
15 {
16 public:
17 virtual ~ISyncPrimitive() = default;
18
22 [[nodiscard]] virtual Result<void> acquire(ProcessId pid) = 0;
23
27 [[nodiscard]] virtual Result<void> release(ProcessId pid) = 0;
28
32 [[nodiscard]] virtual Result<void> tryAcquire(ProcessId pid) = 0;
33
35 [[nodiscard]] virtual std::string_view name() const noexcept = 0;
36 };
37
38} // namespace contur
Common interface for synchronization primitives.
virtual ~ISyncPrimitive()=default
virtual Result< void > acquire(ProcessId pid)=0
Attempts to acquire the primitive for a process.
virtual Result< void > tryAcquire(ProcessId pid)=0
Attempts non-blocking acquire.
virtual std::string_view name() const noexcept=0
Human-readable primitive name.
virtual Result< void > release(ProcessId pid)=0
Releases the primitive for a process.
A result type that holds either a success value of type T or an ErrorCode.
Definition error.h:104
Error codes and Result<T> type for fallible operations.
Definition block.h:15
std::uint32_t ProcessId
Unique identifier for a process.
Definition types.h:12
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...