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

refactor: use core ResourceTable in cli #3206

Merged
merged 8 commits into from
Oct 29, 2019

Conversation

bartlomieju
Copy link
Member

Follow up to #3134, #3136 and #3150

@bartlomieju
Copy link
Member Author

@ry this is minimal landable patch with only Repl factored out. PTAL while I start working on breaking out child and worker resources

@bartlomieju
Copy link
Member Author

bartlomieju commented Oct 28, 2019

Interestingly resource are now not properly dropped 🤔 investigating...

EDIT:
I added this to core/resources.rs and sadly it's never called. The same for ReplResource and Repl. This is strange...

impl Drop for ResourceTable {
  fn drop(&mut self) {
    eprintln!("dropping resource table");
  }
}

EDIT 2:
Now I'm even more confused... From lazy_static docs we can read:

Apart from the lazy initialization, the resulting "static ref" variables have generally the same properties as regular "static" variables:

- Any type in them needs to fulfill the Sync trait.
- If the type has a destructor, then it will not run when the process exits.

AFAIK BTreeMap has a destructor implementation and resources are dropped, however core's ResourceTable is not... 😕

EDIT 3: Nevermind 😅 I screwed op_close implementation

@bartlomieju bartlomieju changed the title [WIP] refactor: use core ResourceTable in cli refactor: use core ResourceTable in cli Oct 28, 2019
@ry ry requested a review from piscisaureus October 28, 2019 23:11
core/resources.rs Show resolved Hide resolved
Copy link
Member

@piscisaureus piscisaureus left a comment

Choose a reason for hiding this comment

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

nice work, lgtm!

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM too - nice work.

@ry ry merged commit a7992e7 into denoland:master Oct 29, 2019
@bartlomieju bartlomieju deleted the cli-resource_table branch October 29, 2019 09:00
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.

3 participants