Skip to content

Commit

Permalink
Release v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Nov 8, 2024
1 parent 90ff210 commit 0aeca27
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Version history

## 0.1.2

- Block socket startup if no thread is available.

## 0.1.1

- Add `CHANGELOG.md`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# zmq-anyio

Asynchronous API for ZMQ using AnyIO
Asynchronous API for ZMQ using AnyIO.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "zmq-anyio"
version = "0.1.1"
version = "0.1.2"
description = "Asynchronous API for ZMQ using AnyIO"
readme = "README.md"
authors = [
Expand Down
10 changes: 5 additions & 5 deletions src/zmq_anyio/_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class Socket(zmq.Socket):
_select_socket_r = None
_select_socket_w = None
_stopped = None
_started = None
started = None

def __init__(
self,
Expand Down Expand Up @@ -197,7 +197,7 @@ def __init__(
self._select_socket_r, self._select_socket_w = socketpair()
self._select_socket_r.setblocking(False)
self._select_socket_w.setblocking(False)
self._started = Event()
self.started = Event()
self._stopped = threading.Event()

def close(self, linger: int | None = None) -> None:
Expand Down Expand Up @@ -694,13 +694,13 @@ async def __aexit__(self, exc_type, exc_value, exc_tb):

async def start(self, *, task_status: TaskStatus[None] = TASK_STATUS_IGNORED) -> None:
assert self._task_group is not None
assert self._started is not None
assert self.started is not None
self._task_group.start_soon(partial(to_thread.run_sync, self._reader, abandon_on_cancel=True))
await self._started.wait()
await self.started.wait()
task_status.started()

def _reader(self):
from_thread.run_sync(self._started.set)
from_thread.run_sync(self.started.set)
while True:
try:
rs, ws, xs = select.select([self._shadow_sock, self._select_socket_r.fileno()], [], [self._shadow_sock, self._select_socket_r.fileno()])
Expand Down

0 comments on commit 0aeca27

Please sign in to comment.