Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "sigq" -version = "0.13.2" +version = "0.13.3" authors = ["Jan Danielsson "] edition = "2021" license = "0BSD" categories = [ "asynchronous", "concurrency", "data-structures" ] keywords = [ "threads", "sync" ] Index: src/pull.rs ================================================================== --- src/pull.rs +++ src/pull.rs @@ -24,11 +24,11 @@ /// `Puller`. #[cfg_attr(feature = "inline-more", inline)] pub fn pop(&self) -> Result { let mut inner = self.0.inner.lock(); loop { - if inner.npushers == 0 { + if inner.q.is_empty() && inner.npushers == 0 { break Err(StaleErr); } else { match inner.q.pop_front() { Some(node) => { break Ok(node); @@ -129,11 +129,11 @@ ) -> Poll { let mut inner = self.ctx.inner.lock(); match inner.q.pop_front() { Some(node) => Poll::Ready(Ok(node)), None => { - if inner.npushers == 0 { + if inner.q.is_empty() && inner.npushers == 0 { // No more nodes and no more pushers, so return None Poll::Ready(Err(StaleErr)) } else { // Generate a unique identifier for this waker let id = loop { Index: www/changelog.md ================================================================== --- www/changelog.md +++ www/changelog.md @@ -7,43 +7,39 @@ ### Changed ### Removed -## [0.13.2] - 2023-07-26 +## [0.13.3] - 2023-07-27 + +### Changed + +- Fixed bug that caused `Puller` to return `Err(StaleErr)` even though nodes + still remain in the queue. + -### Added +## [0.13.2] - 2023-07-26 ### Changed - Documentation updates. -### Removed - ## [0.13.1] - 2023-07-25 -### Added - ### Changed - When the last `Puller` is dropped, clear the queue. -### Removed - ## [0.13.0] - 2023-07-25 -### Added - ### Changed - `Pusher::push()` will return `Err(StaleErr)` if there are no more associated `Puller`s. -### Removed - ## [0.12.0] - 2023-07-24 ### Added @@ -59,12 +55,10 @@ - Dependencies updated: - `indexmap` updated to `2.0.0` - Use Rust edition 2021. - Bump MSRV to 1.64 (based on MSRV in `indexmap`) -### Removed - ## [0.11.0] - 2022-09-09 ### Added