Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ manifest = "bake/Cargo.toml"
reviewers = ["socketry/managers"]

[workspace.package]
version = "0.1.0"
version = "0.1.1"
edition = "2024"
license = "MIT"
repository = "https://github.com/socketry/socketry-rust"
Expand All @@ -25,7 +25,7 @@ readme = "readme.md"
include = ["Cargo.toml", "readme.md", "license.md", "releases.md", "context/**", "src/**"]

[dependencies]
socketry-executor = { version = "0.1.0", path = "crates/executor", default-features = false }
socketry-executor = { version = "0.1.1", path = "crates/executor", default-features = false }

[features]
default = ["native"]
Expand Down
3 changes: 3 additions & 0 deletions bake/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use bake::{Context, Registry, Result};
use bake_agent_context as _;
use bake_cargo as _;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/examples/portable_io.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! The same TCP exchange, compiled against Socketry or Tokio.
#[cfg(any(feature = "native", feature = "tokio"))]
use socketry_executor::{Network, Spawn};
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/examples/work_stealing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use socketry_executor::{Scheduler, Task, yield_now};

fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/barrier.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use crate::owner::Owner;
use crate::{SchedulerHandle, Spawn, SpawnError, Task, TaskHandle};
use std::future::Future;
Expand Down
4 changes: 3 additions & 1 deletion crates/executor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Owned tasks and cooperative future polling on work-stealing workers.
//!
//! Tasks require `Send + 'static` and use the ordinary worker thread stack.
//! The scheduler owns spawned tasks even when their join handles are dropped.
//! Use a [`Barrier`] to explicitly own a group of child tasks.

#![doc = include_str!("../readme.md")]

mod barrier;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/owner.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use crate::TaskError;
use event_listener::Event;
use std::fmt;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/scheduler/file.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Blocking positioned file operations shared by selector adapters.
use std::fs::File;
use std::io;
Expand Down
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Scheduler implementations and their I/O selectors.
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Scheduler implementations and their I/O selectors.
use std::fs::File;
use std::future::Future;
use std::io;
Expand Down
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/selector/epoll.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Linux/Android readiness selector. `async-io` uses `polling`'s epoll backend.
//! Reads and writes share the nonblocking readiness fallback.

pub use super::readiness::{Listener, Selector, Socket};
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/selector/io_uring.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Linux completion reads/writes using a ring owned by a dedicated selector
//! thread. Tasks communicate through owned requests and standard wakers, so
//! operation futures remain Send and can migrate between executor workers.
Expand All @@ -11,7 +14,6 @@
//! This initial implementation uses one channel request and one completion
//! channel per operation. It does not yet pool operation records or register
//! buffers with the kernel.

use super::readiness::{self, Listener, Socket};
use crate::scheduler::{BufferResult, Clock, FileIo, Interest, Network};
use event_listener::{Event as CompletionEvent, Listener as _};
Expand Down
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/selector/iocp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Windows socket readiness selector, using `polling`'s IOCP/AFD backend through
//! `async-io`. File operations use the blocking pool. This does not yet submit
//! native overlapped file reads or writes.

pub use super::readiness::{Listener, Selector, Socket};
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/selector/kqueue.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Apple/BSD readiness selector. `async-io` uses `polling`'s kqueue backend.
//! Registrations are reused across operations and task migration.

pub use super::readiness::{Listener, Selector, Socket};
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/selector/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Native I/O selectors. Platform modules select the OS mechanism at compile
//! time; Tokio supplies a separate runtime adapter in `scheduler::tokio`.

#[cfg(feature = "native")]
pub mod readiness;

Expand Down
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/selector/readiness.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Shared readiness operations backed by `async-io`'s persistent registrations.
//!
//! Its process-wide reactor drives OS events independently of our executor.
//! It remains available while registered resources are alive; Socketry task
//! shutdown does not shut down that shared reactor. Futures contain no private
//! coroutine stacks and may be polled on different workers.

use crate::scheduler::file::{read_at, write_at};
use crate::scheduler::{BufferResult, Clock, FileIo, Interest, Network};
use async_io::Async;
Expand Down
4 changes: 3 additions & 1 deletion crates/executor/src/scheduler/socketry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Socketry's work-stealing executor and scheduler context.
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Socketry's work-stealing executor and scheduler context.
#[cfg(feature = "native")]
mod operations;

Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/scheduler/socketry/operations.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Native selector operations exposed by Socketry schedulers and handles.
use super::{Scheduler, SchedulerHandle};
use crate::scheduler::selector::DefaultSelector;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/scheduler/tokio.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Adapter for an existing, running Tokio runtime with I/O and time enabled.
//!
//! This adapter owns the tasks it spawns, but does not own or drive the Tokio
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/task.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use crate::owner::Owner;
use crate::scheduler::{SchedulerHandle, Shared};
use pin_project_lite::pin_project;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/src/worker.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use crate::scheduler::{self, Shared};
use crate::task::{Runnable, Task, UNASSIGNED_WORKER};
use crossbeam_deque::{Injector, Steal, Stealer, Worker};
Expand Down
4 changes: 4 additions & 0 deletions crates/executor/tests/io.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#![cfg(any(feature = "native", feature = "tokio"))]

// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

mod support;

use socketry_executor::{Clock, FileIo, Interest, Network, Spawn};
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/tests/ownership.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

mod support;

use socketry_executor::{Scheduler, Spawn, SpawnError, TaskError, yield_now};
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/tests/parking.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use loom::sync::Arc;
use loom::sync::atomic::{AtomicBool, AtomicUsize, Ordering, fence};
use loom::thread;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/tests/scheduler.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

mod support;

use socketry_executor::{Scheduler, SchedulerHandle, Task, TaskError, TaskHandle, yield_now};
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/tests/support/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#![allow(dead_code)]

// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::Receiver;
Expand Down
3 changes: 3 additions & 0 deletions crates/executor/tests/work_stealing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

mod support;

use socketry_executor::Scheduler;
Expand Down
2 changes: 1 addition & 1 deletion license.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2026 Samuel Williams
Copyright, 2026, by Samuel Williams.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 16 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ pull request. After review and merge, GitHub Actions publishes the release
when the configured `crates-io` environment approves it. See the
[Cargo publishing guide](https://github.com/socketry/bake-cargo-rust/blob/main/context/publishing.md).

## Releases

<!-- bake-readme:releases:start -->
See [releases.md](releases.md) for the full release history.

### v0.1.1

- Create or update GitHub Releases after successful crates.io publication.
- Move implementation and design guidance into the package's public context.
- Add Bake Agent Context tasks to the repository's development workspace.
<!-- bake-readme:releases:end -->

## See Also

- [socketry](https://github.com/socketry/socketry-rust) — Foundational concurrency APIs for Socketry <!-- bake-readme:package -->

## Contributing

Please open an issue or pull request on [GitHub](https://github.com/socketry/socketry-rust).
Expand Down
3 changes: 2 additions & 1 deletion releases.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Releases

## Unreleased
## v0.1.1

- Create or update GitHub Releases after successful crates.io publication.
- Move implementation and design guidance into the package's public context.
- Add Bake Agent Context tasks to the repository's development workspace.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Foundational concurrency APIs for Socketry.
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

//! Foundational concurrency APIs for Socketry.
#![doc = include_str!("../readme.md")]

pub use socketry_executor as executor;
Expand Down
Loading