100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth range given to batch 22), each with at least one independent contract-edge defect and plain public docs. Claude reviewed 100/100 USABLE against current digests; no ID or source overlap with main or batch 22. Difficulty is unmeasured. progress.md records the wrap-up: all Codex sessions and Qwen schedulers stopped for the user's rollout, Qwen results so far (57 HARD of 373), and what is left on each batch branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
85 lines
1.9 KiB
C++
85 lines
1.9 KiB
C++
#ifndef ASYNC_MODEL_HPP
|
|
#define ASYNC_MODEL_HPP
|
|
#include <cstdint>
|
|
#include <memory>
|
|
namespace async_model {
|
|
enum class Status : int32_t {
|
|
OK = 0,
|
|
BADARG = 1,
|
|
BADFD = 2,
|
|
EXISTS = 3,
|
|
FULL = 4,
|
|
ACCESS = 5,
|
|
AGAIN = 6,
|
|
NOSPACE = 7
|
|
};
|
|
struct OwnerResult {
|
|
Status status;
|
|
int32_t owner;
|
|
};
|
|
struct EnabledResult {
|
|
Status status;
|
|
int32_t enabled;
|
|
};
|
|
struct DescriptionResult {
|
|
Status status;
|
|
uint64_t id;
|
|
int32_t device;
|
|
int32_t mode;
|
|
int32_t aliases;
|
|
int32_t owner;
|
|
int32_t enabled;
|
|
};
|
|
struct WriteResult {
|
|
Status status;
|
|
int32_t accepted;
|
|
int32_t emitted;
|
|
uint64_t sequence;
|
|
};
|
|
struct Event {
|
|
uint64_t sequence;
|
|
uint64_t description;
|
|
int32_t device;
|
|
int32_t recipient;
|
|
int32_t band;
|
|
int32_t bytes;
|
|
};
|
|
struct EventResult {
|
|
Status status;
|
|
Event event;
|
|
};
|
|
struct Stats {
|
|
int32_t open_fds;
|
|
int32_t open_descriptions;
|
|
int32_t subscriptions;
|
|
int32_t pending;
|
|
uint64_t next_description_id;
|
|
uint64_t last_write_sequence;
|
|
};
|
|
namespace detail { struct Runtime; }
|
|
class AsyncModel {
|
|
public:
|
|
AsyncModel();
|
|
~AsyncModel();
|
|
AsyncModel(const AsyncModel&) = delete;
|
|
AsyncModel& operator=(const AsyncModel&) = delete;
|
|
void reset();
|
|
Status open(int32_t fd, int32_t device, int32_t mode);
|
|
Status duplicate(int32_t source_fd, int32_t target_fd);
|
|
Status close(int32_t fd);
|
|
Status set_owner(int32_t fd, int32_t owner);
|
|
OwnerResult owner(int32_t fd) const;
|
|
Status set_async(int32_t fd, int32_t enabled);
|
|
EnabledResult async_enabled(int32_t fd) const;
|
|
WriteResult write(int32_t fd, int32_t byte_count);
|
|
DescriptionResult describe(int32_t fd) const;
|
|
int32_t pending() const;
|
|
EventResult peek() const;
|
|
EventResult take();
|
|
Stats stats() const;
|
|
private:
|
|
std::unique_ptr<detail::Runtime> runtime_;
|
|
};
|
|
}
|
|
#endif
|