From b5ed5bb6dd1ab2aad539b90f3631aebc8dbf48a2 Mon Sep 17 00:00:00 2001 From: James Munns Date: Thu, 8 Jan 2026 00:47:11 +0100 Subject: [PATCH 1/5] A few docs and organization changes --- bbq2/src/lib.rs | 23 ++++++++++++++++++++--- bbq2/src/nicknames.rs | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/bbq2/src/lib.rs b/bbq2/src/lib.rs index 785bc15..452d18e 100644 --- a/bbq2/src/lib.rs +++ b/bbq2/src/lib.rs @@ -91,9 +91,23 @@ //! } //! ``` //! -//! ## Features +//! ## Nicknames //! -//! TODO +//! bbqueue uses generics to customize the data structure in four main ways: +//! +//! * Whether the byte storage is inline (and const-generic), or heap allocated +//! * Whether the queue is polling-only, or supports async/await sending/receiving +//! * Whether the queue uses a lock-free algorithm with CAS atomics, or uses a critical section +//! (for targets that don't have CAS atomics) +//! * Whether the queue is reference counted, allowing Producer and Consumer halves to be passed +//! around without lifetimes. +//! +//! See the [`nicknames`](crate::nicknames) module for all sixteen variants. +//! +//! ## Stability +//! +//! `bbqueue` v0.6 is a breaking change from the older "classic" v0.5 interfaces. The intent is to +//! have a few minor breaking changes in early 2026, and to get to v1.0 as quickly as possible. #![cfg_attr(not(any(test, feature = "std")), no_std)] #![deny(missing_docs)] @@ -112,7 +126,10 @@ pub mod prod_cons; /// Queue storage /// -pub mod queue; +mod queue; +pub use queue::BBQueue; +#[cfg(feature = "alloc")] +pub use queue::ArcBBQueue; /// Generic traits /// diff --git a/bbq2/src/nicknames.rs b/bbq2/src/nicknames.rs index 318173a..2939993 100644 --- a/bbq2/src/nicknames.rs +++ b/bbq2/src/nicknames.rs @@ -30,7 +30,7 @@ use crate::traits::coordination::cs::CsCoord; #[cfg(feature = "alloc")] use crate::traits::storage::BoxedSlice; use crate::{ - queue::BBQueue, + BBQueue, traits::{notifier::polling::Polling, storage::Inline}, }; From 844db3c0de5cb0bd537956547b85b3be51545e44 Mon Sep 17 00:00:00 2001 From: James Munns Date: Thu, 8 Jan 2026 00:49:30 +0100 Subject: [PATCH 2/5] bbq2 is the new bbqueue --- bbq2/Cargo.toml | 8 ++++---- legacy-bbqtest/Cargo.toml | 3 ++- legacy-core/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bbq2/Cargo.toml b/bbq2/Cargo.toml index 75456c7..1bb96bf 100644 --- a/bbq2/Cargo.toml +++ b/bbq2/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "bbq2" -version = "0.4.3" +name = "bbqueue" +version = "0.6.0" description = "A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers" repository = "https://github.com/jamesmunns/bbqueue" authors = ["James Munns "] @@ -13,8 +13,8 @@ categories = [ "memory-management", ] license = "MIT OR Apache-2.0" -keywords = [] -documentation = "https://docs.rs/bbq2/" +keywords = ["bipbuffer", "lock-free"] +documentation = "https://docs.rs/bbqueue/" [package.metadata.docs.rs] rustdoc-args = ["--cfg", "docsrs"] diff --git a/legacy-bbqtest/Cargo.toml b/legacy-bbqtest/Cargo.toml index b219766..20293d8 100644 --- a/legacy-bbqtest/Cargo.toml +++ b/legacy-bbqtest/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bbqtest" +name = "legacy-bbqtest" version = "0.1.0" authors = ["James Munns "] edition = "2018" @@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0" bounded-spsc-queue = { version = "0.4.0", optional = true } [dependencies.bbqueue] +package = "legacy-bbqueue" path = "../legacy-core" diff --git a/legacy-core/Cargo.toml b/legacy-core/Cargo.toml index bc4714a..a5f8338 100644 --- a/legacy-core/Cargo.toml +++ b/legacy-core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bbqueue" +name = "legacy-bbqueue" version = "0.5.1" description = "A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers" repository = "https://github.com/jamesmunns/bbqueue" From 1b22ea9ee31eb78e389feb9dab561452a5e8b52c Mon Sep 17 00:00:00 2001 From: James Munns Date: Thu, 8 Jan 2026 00:49:53 +0100 Subject: [PATCH 3/5] bless bbq2 as bbqueue --- bbq2/Cargo.lock | 669 ------------------ {bbq2 => bbqueue}/.gitignore | 0 {bbq2 => bbqueue}/Cargo.toml | 0 {bbq2 => bbqueue}/README.md | 0 {bbq2 => bbqueue}/miri.sh | 0 {bbq2 => bbqueue}/src/lib.rs | 0 {bbq2 => bbqueue}/src/nicknames.rs | 0 {bbq2 => bbqueue}/src/prod_cons/framed.rs | 0 {bbq2 => bbqueue}/src/prod_cons/mod.rs | 0 {bbq2 => bbqueue}/src/prod_cons/stream.rs | 0 {bbq2 => bbqueue}/src/queue.rs | 0 {bbq2 => bbqueue}/src/traits/bbqhdl.rs | 0 .../src/traits/coordination/cas.rs | 0 .../src/traits/coordination/cs.rs | 0 .../src/traits/coordination/mod.rs | 0 {bbq2 => bbqueue}/src/traits/mod.rs | 0 .../src/traits/notifier/maitake.rs | 0 {bbq2 => bbqueue}/src/traits/notifier/mod.rs | 0 .../src/traits/notifier/polling.rs | 0 {bbq2 => bbqueue}/src/traits/storage.rs | 0 20 files changed, 669 deletions(-) delete mode 100644 bbq2/Cargo.lock rename {bbq2 => bbqueue}/.gitignore (100%) rename {bbq2 => bbqueue}/Cargo.toml (100%) rename {bbq2 => bbqueue}/README.md (100%) rename {bbq2 => bbqueue}/miri.sh (100%) rename {bbq2 => bbqueue}/src/lib.rs (100%) rename {bbq2 => bbqueue}/src/nicknames.rs (100%) rename {bbq2 => bbqueue}/src/prod_cons/framed.rs (100%) rename {bbq2 => bbqueue}/src/prod_cons/mod.rs (100%) rename {bbq2 => bbqueue}/src/prod_cons/stream.rs (100%) rename {bbq2 => bbqueue}/src/queue.rs (100%) rename {bbq2 => bbqueue}/src/traits/bbqhdl.rs (100%) rename {bbq2 => bbqueue}/src/traits/coordination/cas.rs (100%) rename {bbq2 => bbqueue}/src/traits/coordination/cs.rs (100%) rename {bbq2 => bbqueue}/src/traits/coordination/mod.rs (100%) rename {bbq2 => bbqueue}/src/traits/mod.rs (100%) rename {bbq2 => bbqueue}/src/traits/notifier/maitake.rs (100%) rename {bbq2 => bbqueue}/src/traits/notifier/mod.rs (100%) rename {bbq2 => bbqueue}/src/traits/notifier/polling.rs (100%) rename {bbq2 => bbqueue}/src/traits/storage.rs (100%) diff --git a/bbq2/Cargo.lock b/bbq2/Cargo.lock deleted file mode 100644 index 9e3d1d8..0000000 --- a/bbq2/Cargo.lock +++ /dev/null @@ -1,669 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bbq2" -version = "0.4.3" -dependencies = [ - "const-init", - "critical-section", - "maitake-sync", - "tokio", -] - -[[package]] -name = "cc" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac367972e516d45567c7eafc73d24e1c193dcf200a8d94e9db7b3d38b349572d" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "const-init" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd422bfb4f24a97243f60b6a4443e63d810c925d8da4bb2d8fde26a7c1d57ec" - -[[package]] -name = "cordyceps" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec10f0a762d93c4498d2e97a333805cb6250d60bead623f71d8034f9a4152ba3" -dependencies = [ - "loom 0.5.6", - "tracing", -] - -[[package]] -name = "critical-section" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" - -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows 0.48.0", -] - -[[package]] -name = "generator" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186014d53bc231d0090ef8d6f03e0920c54d85a5ed22f4f2f74315ec56cf83fb" -dependencies = [ - "cc", - "cfg-if", - "libc", - "log", - "rustversion", - "windows 0.54.0", -] - -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator 0.7.5", - "scoped-tls", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "loom" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" -dependencies = [ - "cfg-if", - "generator 0.8.1", - "scoped-tls", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "maitake-sync" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0467b24ad105bb1873a1ad7b6b5515cd383f33f1df293ec05f82b5632d0e07cd" -dependencies = [ - "cordyceps", - "loom 0.7.2", - "mutex-traits", - "mycelium-bitfield", - "pin-project", - "portable-atomic", - "tracing", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "mutex-traits" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd54cb762feb1788c74f5d3387983864d2365ca1819043d2addb76db80169102" - -[[package]] -name = "mycelium-bitfield" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "object" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "portable-atomic" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "regex" -version = "1.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "syn" -version = "2.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tokio" -version = "1.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" -dependencies = [ - "backtrace", - "pin-project-lite", - "tokio-macros", -] - -[[package]] -name = "tokio-macros" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" -dependencies = [ - "windows-core", - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-core" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" -dependencies = [ - "windows-result", - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-result" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" -dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/bbq2/.gitignore b/bbqueue/.gitignore similarity index 100% rename from bbq2/.gitignore rename to bbqueue/.gitignore diff --git a/bbq2/Cargo.toml b/bbqueue/Cargo.toml similarity index 100% rename from bbq2/Cargo.toml rename to bbqueue/Cargo.toml diff --git a/bbq2/README.md b/bbqueue/README.md similarity index 100% rename from bbq2/README.md rename to bbqueue/README.md diff --git a/bbq2/miri.sh b/bbqueue/miri.sh similarity index 100% rename from bbq2/miri.sh rename to bbqueue/miri.sh diff --git a/bbq2/src/lib.rs b/bbqueue/src/lib.rs similarity index 100% rename from bbq2/src/lib.rs rename to bbqueue/src/lib.rs diff --git a/bbq2/src/nicknames.rs b/bbqueue/src/nicknames.rs similarity index 100% rename from bbq2/src/nicknames.rs rename to bbqueue/src/nicknames.rs diff --git a/bbq2/src/prod_cons/framed.rs b/bbqueue/src/prod_cons/framed.rs similarity index 100% rename from bbq2/src/prod_cons/framed.rs rename to bbqueue/src/prod_cons/framed.rs diff --git a/bbq2/src/prod_cons/mod.rs b/bbqueue/src/prod_cons/mod.rs similarity index 100% rename from bbq2/src/prod_cons/mod.rs rename to bbqueue/src/prod_cons/mod.rs diff --git a/bbq2/src/prod_cons/stream.rs b/bbqueue/src/prod_cons/stream.rs similarity index 100% rename from bbq2/src/prod_cons/stream.rs rename to bbqueue/src/prod_cons/stream.rs diff --git a/bbq2/src/queue.rs b/bbqueue/src/queue.rs similarity index 100% rename from bbq2/src/queue.rs rename to bbqueue/src/queue.rs diff --git a/bbq2/src/traits/bbqhdl.rs b/bbqueue/src/traits/bbqhdl.rs similarity index 100% rename from bbq2/src/traits/bbqhdl.rs rename to bbqueue/src/traits/bbqhdl.rs diff --git a/bbq2/src/traits/coordination/cas.rs b/bbqueue/src/traits/coordination/cas.rs similarity index 100% rename from bbq2/src/traits/coordination/cas.rs rename to bbqueue/src/traits/coordination/cas.rs diff --git a/bbq2/src/traits/coordination/cs.rs b/bbqueue/src/traits/coordination/cs.rs similarity index 100% rename from bbq2/src/traits/coordination/cs.rs rename to bbqueue/src/traits/coordination/cs.rs diff --git a/bbq2/src/traits/coordination/mod.rs b/bbqueue/src/traits/coordination/mod.rs similarity index 100% rename from bbq2/src/traits/coordination/mod.rs rename to bbqueue/src/traits/coordination/mod.rs diff --git a/bbq2/src/traits/mod.rs b/bbqueue/src/traits/mod.rs similarity index 100% rename from bbq2/src/traits/mod.rs rename to bbqueue/src/traits/mod.rs diff --git a/bbq2/src/traits/notifier/maitake.rs b/bbqueue/src/traits/notifier/maitake.rs similarity index 100% rename from bbq2/src/traits/notifier/maitake.rs rename to bbqueue/src/traits/notifier/maitake.rs diff --git a/bbq2/src/traits/notifier/mod.rs b/bbqueue/src/traits/notifier/mod.rs similarity index 100% rename from bbq2/src/traits/notifier/mod.rs rename to bbqueue/src/traits/notifier/mod.rs diff --git a/bbq2/src/traits/notifier/polling.rs b/bbqueue/src/traits/notifier/polling.rs similarity index 100% rename from bbq2/src/traits/notifier/polling.rs rename to bbqueue/src/traits/notifier/polling.rs diff --git a/bbq2/src/traits/storage.rs b/bbqueue/src/traits/storage.rs similarity index 100% rename from bbq2/src/traits/storage.rs rename to bbqueue/src/traits/storage.rs From 8a52435d64f81228782801b0e898786b644f07e9 Mon Sep 17 00:00:00 2001 From: James Munns Date: Thu, 8 Jan 2026 00:54:49 +0100 Subject: [PATCH 4/5] Update some remaining bbq2s --- .github/workflows/build.yml | 14 ++--- .github/workflows/miri.yml | 4 +- Cargo.toml | 2 +- README.md | 73 +++++++++++++++++---------- bbqueue/Cargo.toml | 2 +- bbqueue/README.md | 8 --- bbqueue/src/lib.rs | 4 +- bbqueue/src/traits/coordination/cs.rs | 2 +- 8 files changed, 61 insertions(+), 48 deletions(-) delete mode 100644 bbqueue/README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b78f9e7..0ff3c86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: defaults: run: - working-directory: ./bbq2 + working-directory: ./bbqueue jobs: build: @@ -23,22 +23,22 @@ jobs: # BUILD + TEST # # no features, on std - - name: Check bbq2 (no features, on host) + - name: Check bbqueue (no features, on host) run: cargo build --no-default-features # default features, on std - - name: Check bbq2 (default features, on host) + - name: Check bbqueue (default features, on host) run: cargo build # std features, on std - - name: Check bbq2 (std features, on host) + - name: Check bbqueue (std features, on host) run: cargo build --features=std # std features, on std, test - - name: Test bbq2 (std features, on host) + - name: Test bbqueue (std features, on host) run: cargo test --features=std # no features, on mcu - - name: Check bbq2 (no features, on mcu) + - name: Check bbqueue (no features, on mcu) run: cargo build --no-default-features --target=thumbv6m-none-eabi # default features, on mcu - - name: Check bbq2 (no features, on mcu) + - name: Check bbqueue (no features, on mcu) run: cargo build --target=thumbv6m-none-eabi diff --git a/.github/workflows/miri.yml b/.github/workflows/miri.yml index 90debb3..fd2ffd1 100644 --- a/.github/workflows/miri.yml +++ b/.github/workflows/miri.yml @@ -9,7 +9,7 @@ on: defaults: run: - working-directory: ./bbq2 + working-directory: ./bbqueue jobs: miri: @@ -22,5 +22,5 @@ jobs: # # crate # - - name: Miri test bbq2 + - name: Miri test bbqueue run: ./miri.sh diff --git a/Cargo.toml b/Cargo.toml index 6f72169..348ac1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "3" members = [ - "bbq2", + "bbqueue", "legacy-bbqtest", "legacy-core", ] diff --git a/README.md b/README.md index e186bd9..3e2ab0b 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,12 @@ [![Documentation](https://docs.rs/bbqueue/badge.svg)](https://docs.rs/bbqueue) +# BBQueue + BBQueue, short for "BipBuffer Queue", is a Single Producer Single Consumer, lockless, no_std, thread safe, queue, based on [BipBuffers]. For more info on the design of the lock-free algorithm used by bbqueue, see [this blog post]. -For a 90 minute guided tour of BBQueue, you can also view this [guide on YouTube]. - -[guide on YouTube]: https://www.youtube.com/watch?v=ngTCf2cnGkY [BipBuffers]: https://www.codeproject.com/articles/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist [this blog post]: https://ferrous-systems.com/blog/lock-free-ring-buffer/ @@ -22,9 +21,14 @@ block of contiguous memory, which can be filled (or emptied) by a DMA engine. ## Local usage ```rust +// The "Churrasco" flavor has inline storage, hardware atomic +// support, no async support, and is not reference counted. +use bbqueue::nicknames::Churrasco; + // Create a buffer with six elements -let bb: BBBuffer<6> = BBBuffer::new(); -let (mut prod, mut cons) = bb.try_split().unwrap(); +let bb: Churrasco<6> = Churrasco::new(); +let prod = bb.stream_producer(); +let cons = bb.stream_consumer(); // Request space for one byte let mut wgr = prod.grant_exact(1).unwrap(); @@ -48,17 +52,32 @@ rgr.release(1); ## Static usage -```rust, no_run -use bbqueue::BBBuffer; +```rust +use bbqueue::nicknames::Churrasco; +use std::{thread::{sleep, spawn}, time::Duration}; // Create a buffer with six elements -static BB: BBBuffer<6> = BBBuffer::new(); +static BB: Churrasco<6> = Churrasco::new(); + +fn receiver() { + let cons = BB.stream_consumer(); + loop { + if let Ok(rgr) = cons.read() { + assert_eq!(rgr.len(), 1); + assert_eq!(rgr[0], 123); + rgr.release(1); + break; + } + // don't do this in real code, use Notify! + sleep(Duration::from_millis(10)); + } +} fn main() { - // Split the bbqueue into producer and consumer halves. - // These halves can be sent to different threads or to - // an interrupt handler for thread safe SPSC usage - let (mut prod, mut cons) = BB.try_split().unwrap(); + let prod = BB.stream_producer(); + + // spawn the consumer + let hdl = spawn(receiver); // Request space for one byte let mut wgr = prod.grant_exact(1).unwrap(); @@ -71,26 +90,28 @@ fn main() { // Make the data ready for consuming wgr.commit(1); - // Read all available bytes - let rgr = cons.read().unwrap(); + // make sure the receiver terminated + hdl.join().unwrap(); +} +``` - assert_eq!(rgr[0], 123); +## Nicknames - // Release the space for later writes - rgr.release(1); +bbqueue uses generics to customize the data structure in four main ways: - // The buffer cannot be split twice - assert!(BB.try_split().is_err()); -} -``` +* Whether the byte storage is inline (and const-generic), or heap allocated +* Whether the queue is polling-only, or supports async/await sending/receiving +* Whether the queue uses a lock-free algorithm with CAS atomics, or uses a critical section + (for targets that don't have CAS atomics) +* Whether the queue is reference counted, allowing Producer and Consumer halves to be passed + around without lifetimes. -The `bbqueue` crate is located in `core/`, and tests are located in `bbqtest/`. +See the [`nicknames`](crate::nicknames) module for all sixteen variants. -## Features +## Stability -By default BBQueue uses atomic operations which are available on most platforms. However on some -(mostly embedded) platforms atomic support is limited and with the default features you will get -a compiler error about missing atomic methods. +`bbqueue` v0.6 is a breaking change from the older "classic" v0.5 interfaces. The intent is to +have a few minor breaking changes in early 2026, and to get to v1.0 as quickly as possible. # License diff --git a/bbqueue/Cargo.toml b/bbqueue/Cargo.toml index 1bb96bf..0b22f57 100644 --- a/bbqueue/Cargo.toml +++ b/bbqueue/Cargo.toml @@ -5,7 +5,7 @@ description = "A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers repository = "https://github.com/jamesmunns/bbqueue" authors = ["James Munns "] edition = "2024" -readme = "README.md" +readme = "../README.md" categories = [ "embedded", diff --git a/bbqueue/README.md b/bbqueue/README.md deleted file mode 100644 index c0a04f0..0000000 --- a/bbqueue/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# bbq2 - -Now with sixteen great flavors! - -This was an attempt to re-implement [bbqueue](https://github.com/jamesmunns/bbqueue). -It will soon be upstreamed to that crate! - -No docs yet. Check out the unit tests in [`lib.rs`](./src/lib.rs) for usage :) diff --git a/bbqueue/src/lib.rs b/bbqueue/src/lib.rs index 452d18e..6a6d303 100644 --- a/bbqueue/src/lib.rs +++ b/bbqueue/src/lib.rs @@ -19,7 +19,7 @@ //! ```rust //! // The "Churrasco" flavor has inline storage, hardware atomic //! // support, no async support, and is not reference counted. -//! use bbq2::nicknames::Churrasco; +//! use bbqueue::nicknames::Churrasco; //! //! // Create a buffer with six elements //! let bb: Churrasco<6> = Churrasco::new(); @@ -49,7 +49,7 @@ //! ## Static usage //! //! ```rust -//! use bbq2::nicknames::Churrasco; +//! use bbqueue::nicknames::Churrasco; //! use std::{thread::{sleep, spawn}, time::Duration}; //! //! // Create a buffer with six elements diff --git a/bbqueue/src/traits/coordination/cs.rs b/bbqueue/src/traits/coordination/cs.rs index 6704af4..5c5dd47 100644 --- a/bbqueue/src/traits/coordination/cs.rs +++ b/bbqueue/src/traits/coordination/cs.rs @@ -1,6 +1,6 @@ //! Mutex/Critical section based coordination //! -//! This is provided so bbq2 is usable on bare metal targets that don't +//! This is provided so `bbqueue` is usable on bare metal targets that don't //! have CAS atomics, like `cortex-m0`/`thumbv6m` targets. use const_init::ConstInit; From b5878ef297d0f186425db58b90ac4a1edfe2fc76 Mon Sep 17 00:00:00 2001 From: James Munns Date: Thu, 8 Jan 2026 00:58:42 +0100 Subject: [PATCH 5/5] Fix docs Closes https://github.com/jamesmunns/bbqueue/issues/112 --- bbqueue/src/traits/coordination/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bbqueue/src/traits/coordination/mod.rs b/bbqueue/src/traits/coordination/mod.rs index 0b49697..3e5a1e0 100644 --- a/bbqueue/src/traits/coordination/mod.rs +++ b/bbqueue/src/traits/coordination/mod.rs @@ -28,9 +28,9 @@ pub enum WriteGrantError { /// Errors associated with obtaining a read grant #[derive(PartialEq, Debug)] pub enum ReadGrantError { - /// Unable to create write grant due to not enough room in the buffer + /// Unable to create read grant due to no available bytes Empty, - /// Unable to create write grant due to existing write grant + /// Unable to create read grant due to existing read grant GrantInProgress, /// We observed a frame header that did not make sense. This should only /// occur if a stream producer was used on one end and a frame consumer was