Skip to content

Conversation

@laines-it
Copy link
Collaborator

@laines-it laines-it commented Dec 2, 2025

This commit reduces allocations.

Future.done allocation replaced with

  • Future.cond (sync.Cond)
  • Future.finished (bool)

Other code use Future.finished instead Future.done == nil check.

Added Future.finish() marks Future as done.
Future.WaitChan() now creates channel on demand.

Closes #496

@laines-it laines-it force-pushed the laines-it/gh-496-replace-Future-chan-cond-Sync branch from dd9e78b to f5ce75f Compare December 2, 2025 14:34
@laines-it laines-it marked this pull request as draft December 2, 2025 14:35
@laines-it laines-it marked this pull request as ready for review December 2, 2025 14:41
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch. Overall, everything's fine.

I've added some implementation notes, but you need to do a proper rebase first.

@oleg-jukovec
Copy link
Collaborator

Please, rebase on the master branch.

@laines-it laines-it force-pushed the laines-it/gh-496-replace-Future-chan-cond-Sync branch from f5ce75f to d238853 Compare December 6, 2025 07:52
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch! I have just a one mirror comment:

@laines-it laines-it force-pushed the laines-it/gh-496-replace-Future-chan-cond-Sync branch from d238853 to 948fcee Compare December 7, 2025 08:16
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch!

@laines-it laines-it force-pushed the laines-it/gh-496-replace-Future-chan-cond-Sync branch 2 times, most recently from da9ec89 to 364deec Compare December 9, 2025 20:53
@oleg-jukovec oleg-jukovec requested a review from bigbes December 9, 2025 23:13
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

This commit reduces allocations.

Future.done allocation replaced with
- Future.cond (sync.Cond)
- Future.finished (bool)

Other code use `Future.finished` instead `Future.done == nil` check.

Added Future.finish() marks Future as done.
Future.WaitChan() now creates channel on demand.

Closes #496
@laines-it laines-it force-pushed the laines-it/gh-496-replace-Future-chan-cond-Sync branch from 364deec to 5e96644 Compare December 15, 2025 12:02
@oleg-jukovec oleg-jukovec merged commit 6a24a64 into master Dec 15, 2025
20 of 25 checks passed
@oleg-jukovec oleg-jukovec deleted the laines-it/gh-496-replace-Future-chan-cond-Sync branch December 15, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v3: replace channel in Future with a cond.Sync

4 participants