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 (atomic.Bool)

Other code use Future.isDone() 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:

This commit reduces allocations.

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

Other code use Future.isDone() 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 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!

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

3 participants