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 support for NSAutoreleasePool. #29

Merged
merged 2 commits into from
Feb 28, 2024
Merged

Add support for NSAutoreleasePool. #29

merged 2 commits into from
Feb 28, 2024

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Feb 28, 2024

This PR adds support for NSAutoreleasePool, and for running Julia code with an autorelease pool active. This is tricky for two reasons:

  • autorelease pools are thread bound, while Julia tasks can migrate threads
  • there's no way to switch autorelease pools, while Julia threads can switch between tasks

To work around both, I have a global lock to only ever have one piece of code running under an autorelease pool, while temporarily setting the current task's sticky bit to false to prevent thread migration.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 86.20690% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 72.06%. Comparing base (bbc8095) to head (b7b8c41).

Files Patch % Lines
src/foundation.jl 86.20% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
+ Coverage   69.84%   72.06%   +2.21%     
==========================================
  Files           9        9              
  Lines         630      655      +25     
==========================================
+ Hits          440      472      +32     
+ Misses        190      183       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maleadt maleadt merged commit 6202c8b into master Feb 28, 2024
7 checks passed
@maleadt maleadt deleted the tb/nsautoreleasepool branch February 28, 2024 18:36
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.

1 participant