Skip to content

Conversation

@algebraic-dev
Copy link
Member

This PR adds vectored write for TCP and UDP (that helps a lot with not copying the arrays over and over) and fix a RC issue in TCP and UDP cancel functions with the line lean_dec((lean_object*)udp_socket); and a similar one that tries to decrement the object inside of the socket.

@algebraic-dev algebraic-dev self-assigned this Sep 12, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Sep 12, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 4b6eab762fa3c157b5454a7d804e56923655e88a --onto b64111d5a837bb5273978cf9945bb137a31777b7. You can force Mathlib CI using the force-mathlib-ci label. (2025-09-12 19:15:58)

@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 4b6eab762fa3c157b5454a7d804e56923655e88a --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-09-12 19:16:00)

@algebraic-dev algebraic-dev changed the base branch from sofia/async-basic to sofia/async-io-ops September 12, 2025 19:42
@algebraic-dev algebraic-dev changed the base branch from sofia/async-io-ops to sofia/async-basic September 12, 2025 19:43
@algebraic-dev algebraic-dev changed the base branch from sofia/async-basic to master September 20, 2025 16:42
@algebraic-dev algebraic-dev added this pull request to the merge queue Sep 20, 2025
Merged via the queue into master with commit 6b92cbd Sep 20, 2025
14 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Sep 21, 2025
…dp cancel functions" (#10485)

Reverts #10367 due to Windows build failure
github-merge-queue bot pushed a commit that referenced this pull request Sep 24, 2025
This PR adds `Notify` that is a structure that is similar to `CondVar`
but it's used for concurrency. The main difference between
`Std.Sync.Notify` and `Std.Condvar` is that depends on a `Std.Mutex` and
blocks the entire thread that the `Task` is using while waiting. If I
try to use it with async and a lot of `Task`s like this:

```lean
def condvar : Async Unit := do
  let condvar ← Std.Condvar.new
  let mutex ← Std.Mutex.new false

  for i in [0:threads] do
    background do
      IO.println s!"start {i + 1}"
      await =<< (show IO (ETask _ _) from IO.asTask (mutex.atomically (condvar.wait mutex)))
      IO.println s!"end {i + 1}"

  IO.sleep 2000
  condvar.notifyAll
```

It causes some weird behavior because some tasks start running and get
notified, while others don’t, because `condvar.wait` blocks the `Task`
entire task and right now afaik it blocks an entire thread and cannot be
paused while doing blocking operations like that.

`Notify` uses `Promise`s so it’s better suited for concurrency. The
`Task` is not blocked while waiting for a notification which makes it
simpler for use cases that just involve notifying:

```lean
def notify : Async Unit := do
  let notify ← Std.Notify.new

  for i in [0:threads] do
    background do
      IO.println s!"start {i}"
      notify.wait
      IO.println s!"end {i}"

  IO.sleep 2000
  notify.notify
```

This PR depends on: #10366, #10367 and #10370.
github-merge-queue bot pushed a commit that referenced this pull request Oct 6, 2025
This PR adds a multi-consumer, multi-producer channel to Std.Sync.

This PR depends on: #10366, #10367 and #10370.

---------

Co-authored-by: Markus Himmel <markus@lean-fro.org>
github-merge-queue bot pushed a commit that referenced this pull request Oct 7, 2025
This PR adds the StreamMap type that enables multiplexing in
asynchronous streams.

This PR depends on: #10366, #10367 and #10370.

---------

Co-authored-by: Markus Himmel <markus@lean-fro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants