diff --git a/Cargo.lock b/Cargo.lock index f595ed0..f552549 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,7 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cloudtoid-interprocess" -version = "3.0.1" +version = "3.0.2" dependencies = [ "libc", "windows-sys", @@ -24,14 +24,14 @@ dependencies = [ [[package]] name = "cloudtoid-interprocess-ffi" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cloudtoid-interprocess", ] [[package]] name = "cloudtoid-interprocess-node" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cloudtoid-interprocess", "napi", @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "cloudtoid-interprocess-python" -version = "3.0.1" +version = "3.0.2" dependencies = [ "cloudtoid-interprocess", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 6553fd6..5fec4cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["src/rust", "src/c", "src/python", "src/node"] resolver = "2" [workspace.package] -version = "3.0.1" +version = "3.0.2" edition = "2021" license = "MIT" repository = "https://github.com/cloudtoid/interprocess" diff --git a/src/c/CMakeLists.txt b/src/c/CMakeLists.txt index d3f8378..c036b31 100644 --- a/src/c/CMakeLists.txt +++ b/src/c/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.20) -project(cloudtoid_interprocess VERSION 3.0.1 LANGUAGES C) +project(cloudtoid_interprocess VERSION 3.0.2 LANGUAGES C) include(GNUInstallDirs) find_program(CARGO_EXECUTABLE cargo REQUIRED) get_filename_component(REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../.." ABSOLUTE) diff --git a/src/c/Cargo.toml b/src/c/Cargo.toml index 9d9260f..623beac 100644 --- a/src/c/Cargo.toml +++ b/src/c/Cargo.toml @@ -14,4 +14,4 @@ name = "cloudtoid_interprocess" crate-type = ["cdylib", "staticlib"] [dependencies] -core-queue = { package = "cloudtoid-interprocess", path = "../rust", version = "3.0.1" } +core-queue = { package = "cloudtoid-interprocess", path = "../rust", version = "3.0.2" } diff --git a/src/node/Cargo.toml b/src/node/Cargo.toml index 0891356..45723e8 100644 --- a/src/node/Cargo.toml +++ b/src/node/Cargo.toml @@ -12,7 +12,7 @@ doctest = false crate-type = ["cdylib"] [dependencies] -core-queue = { package = "cloudtoid-interprocess", path = "../rust", version = "3.0.1" } +core-queue = { package = "cloudtoid-interprocess", path = "../rust", version = "3.0.2" } # Native calls are synchronous; JS handles waiting. No N-API thread-safe # callback/GC dispatcher is needed (enabled by napi4 and later). napi = { version = "3", default-features = false, features = ["napi3"] } diff --git a/src/node/package.json b/src/node/package.json index e273475..f2bb316 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -1,6 +1,6 @@ { "name": "@cloudtoid/interprocess", - "version": "3.0.1", + "version": "3.0.2", "description": "Fast shared-memory byte queues across Node.js, Rust, C, Go, Python, and .NET", "main": "index.js", "types": "index.d.ts", @@ -25,11 +25,11 @@ "test": "node --test test.js" }, "optionalDependencies": { - "@cloudtoid/interprocess-darwin-arm64": "3.0.1", - "@cloudtoid/interprocess-darwin-x64": "3.0.1", - "@cloudtoid/interprocess-linux-x64": "3.0.1", - "@cloudtoid/interprocess-win32-x64": "3.0.1", - "@cloudtoid/interprocess-linux-arm64": "3.0.1" + "@cloudtoid/interprocess-darwin-arm64": "3.0.2", + "@cloudtoid/interprocess-darwin-x64": "3.0.2", + "@cloudtoid/interprocess-linux-x64": "3.0.2", + "@cloudtoid/interprocess-win32-x64": "3.0.2", + "@cloudtoid/interprocess-linux-arm64": "3.0.2" }, "exports": { ".": { diff --git a/src/python/Cargo.toml b/src/python/Cargo.toml index c468357..792df65 100644 --- a/src/python/Cargo.toml +++ b/src/python/Cargo.toml @@ -14,7 +14,7 @@ name = "_native" crate-type = ["cdylib"] [dependencies] -core-queue = { package = "cloudtoid-interprocess", path = "../rust", version = "3.0.1" } +core-queue = { package = "cloudtoid-interprocess", path = "../rust", version = "3.0.2" } pyo3 = { version = "0.29", features = ["extension-module", "abi3-py39"] } [build-dependencies] diff --git a/src/python/pyproject.toml b/src/python/pyproject.toml index 1e183a6..da75f21 100644 --- a/src/python/pyproject.toml +++ b/src/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "cloudtoid-interprocess" -version = "3.0.1" +version = "3.0.2" description = "Fast shared-memory byte queues across Python, Rust, C, Go, Node.js, and .NET" requires-python = ">=3.9" license = "MIT" diff --git a/src/python/python/cloudtoid_interprocess/__init__.py b/src/python/python/cloudtoid_interprocess/__init__.py index b27092e..5ae8a93 100644 --- a/src/python/python/cloudtoid_interprocess/__init__.py +++ b/src/python/python/cloudtoid_interprocess/__init__.py @@ -3,4 +3,4 @@ from ._native import Publisher, Subscriber __all__ = ["Publisher", "Subscriber", "InterprocessError", "CapacityMismatchError", "PublisherLimitError", "CorruptQueueError"] -__version__ = "3.0.1" +__version__ = "3.0.2" diff --git a/src/python/src/lib.rs b/src/python/src/lib.rs index ca3740a..28dc4c4 100644 --- a/src/python/src/lib.rs +++ b/src/python/src/lib.rs @@ -143,6 +143,14 @@ impl Subscriber { .map_err(|_| PyValueError::new_err("timeout must be finite and nonnegative")) }) .transpose()?; + if timeout.is_some_and(|limit| limit.is_zero()) { + py.check_signals()?; + let message = self.try_receive(py)?; + if message.is_none() { + py.check_signals()?; + } + return Ok(message); + } let started = Instant::now(); loop { py.check_signals()?; diff --git a/src/python/test_api.py b/src/python/test_api.py index 32c0cf2..c73b5ae 100644 --- a/src/python/test_api.py +++ b/src/python/test_api.py @@ -19,6 +19,7 @@ def test_api(self): self.assertEqual(s.receive(timeout=0), b"a") self.assertEqual(s.receive(timeout=1), b"b") self.assertIsNone(s.receive(timeout=0.005)) + self.assertIsNone(s.receive(timeout=0)) with self.assertRaises(ValueError): s.receive(timeout=-1) with self.assertRaises(ValueError): p.try_send(b"closed") with self.assertRaises(ValueError): s.try_receive()