Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add queued() #118

Merged
merged 4 commits into from Dec 21, 2020
Merged

Add queued() #118

merged 4 commits into from Dec 21, 2020

Conversation

ghost
Copy link

@ghost ghost commented Dec 21, 2020

Currently if a thread calls queueMain() with a function containing GCed memory then exits, it will be freed, causing an invalid memory access. This adds a function that allows threads to wait for all queued functions to be executed before exiting.

Usage:

proc start() =
  {.gcsafe.}:
    # ...
    while app.queued() > 0:
      discard

@simonkrauter simonkrauter merged commit c5c9e7d into simonkrauter:master Dec 21, 2020
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.

2 participants