Skip to content

Resource arenas#6412

Draft
michaellilltokiwa wants to merge 7 commits intotokiwa-software:mainfrom
michaellilltokiwa:resource_arenas
Draft

Resource arenas#6412
michaellilltokiwa wants to merge 7 commits intotokiwa-software:mainfrom
michaellilltokiwa:resource_arenas

Conversation

@michaellilltokiwa
Copy link
Copy Markdown
Member

@tokiwa-software/developers looking for feedback on this.

Motivation: Currently there is no way to return a String backed by mapped_buffer without copying the buffer, (unless we are still inside the callback of the instated mmap-effect).

This PR adds a resource arena of some sorts that handles the closing of the open resources. This means file.open/use now returns a file, no callback anymore. This file can then be used whenever as long as inside of the resources arena.

The user still does not have to, and currently can not, manually close the file. It is manged by the resources effect. Also the user still does not need to handle File_Descriptor in any way.

@michaellilltokiwa michaellilltokiwa requested a review from a team January 27, 2026 17:19
Copy link
Copy Markdown
Collaborator

@maxteufel maxteufel left a comment

Choose a reason for hiding this comment

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

looks nice! how does this fare with multi-threaded environments?

@michaellilltokiwa
Copy link
Copy Markdown
Member Author

looks nice! how does this fare with multi-threaded environments?

Currently not at all. I'm thinking maybe some channel/tunnel effect would be needed to share open resources among threads.

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