amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
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>
2026-10-27 17:52:13 +08:00

63 lines
1.7 KiB
C++

#ifndef BOUNDED_CHANNEL_HPP
#define BOUNDED_CHANNEL_HPP
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
namespace bounded {
enum class ApiCode : uint32_t {
Ok = 0, Invalid = 1, Duplicate = 2, Limit = 3,
NotFound = 4, Busy = 5, AlreadyDone = 6
};
enum class Direction : uint32_t { Read = 0, Write = 1 };
enum class Mode : uint32_t { Blocking = 0, Nonblocking = 1 };
enum class TransferState : uint32_t {
Pending = 0, Complete = 1, Again = 2, Interrupted = 3
};
constexpr uint32_t kNoInterrupt = UINT32_MAX;
struct TransferResult {
uint32_t id;
Direction direction;
Mode mode;
uint32_t requested;
uint32_t transferred;
TransferState state;
uint64_t wait_ticks;
uint32_t remaining_budget;
std::vector<uint8_t> bytes;
};
struct QueryResult {
ApiCode code;
std::optional<TransferResult> value;
};
struct ChannelSnapshot {
uint32_t capacity;
uint32_t used;
uint32_t pending_readers;
uint32_t pending_writers;
uint32_t retained;
uint64_t read_cursor;
uint64_t write_cursor;
uint64_t tick_count;
std::vector<uint8_t> bytes;
};
struct Engine;
class ByteChannel {
public:
ByteChannel();
~ByteChannel();
ApiCode reset(uint32_t capacity);
ApiCode submit_write(uint32_t id, const std::vector<uint8_t>& bytes,
Mode mode, uint32_t wait_budget);
ApiCode submit_read(uint32_t id, uint32_t count, Mode mode, uint32_t wait_budget);
ApiCode tick();
ApiCode interrupt(uint32_t id);
QueryResult result(uint32_t id) const;
ApiCode forget(uint32_t id);
ChannelSnapshot snapshot() const;
private:
std::unique_ptr<Engine> engine_;
};
}
#endif