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

Should Process::drop wait for the child? #13854

Closed
alexcrichton opened this issue Apr 29, 2014 · 5 comments
Closed

Should Process::drop wait for the child? #13854

alexcrichton opened this issue Apr 29, 2014 · 5 comments
Milestone

Comments

@alexcrichton
Copy link
Member

Currently the Drop implementation for Process invokes wait. Apart from blocking in destructors, this could also lead to unexpected results if the desire was to fork off a daemon.

Should we block in wait? If not, who cleans up the resources?

Nominating.

@thestinger
Copy link
Contributor

Modern daemons are not supposed to fork, so I don't think it needs to be taken into account in Rust's design. They're a normal non-forking process, and can be augmented to notify the init system of readiness or make use of socket activation.

There's absolutely no way for forking daemons to avoid race conditions. They can be reliably killed via control groups on Linux, but there's no non-racy/non-polling way to do supervision.

@pnkfelix
Copy link
Member

pnkfelix commented May 1, 2014

Assigning P-backcompat-libs, 1.0 milestone.

@alexcrichton
Copy link
Member Author

@glandium comments in #14410

My use-case is that i want to spawn a (detached) subprocess that survives the parent process. The equivalent of doing "command&" in a shell script.

Per IRC discussion:
forget() it when you're done with it?
it probably shouldn't wait in the destructor
should probably have a separate wait method
afaik we've been trying to avoid blocking destructors
glandium: it could be marked #[must_use] and only be destroyed with a wait or detach method, for example

@alexcrichton
Copy link
Member Author

We talked about this in today's meeting. Invoking wait in drop is required to prevent resource leaks, but having a child outlive the parent is also an important use case. I will open a separate issue on the fix we discussed.

@alexcrichton
Copy link
Member Author

This issue was nominated for the 1.0 milestone, and I have closed it because our resolution was to add a method to explicitly allow a child to outlive the parent. This method can be added in a backwards compatible fashion, so the new issue no longer needs to be on the 1.0 backcompat-lang milestone.

arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
Support multi-character punct tokens in MBE

Fixes rust-lang#11497

In the context of MBE, consecutive puncts are parsed as multi-character punct tokens whenever possible. For example, `:::` is parsed as ``[Punct(`::`), Punct(`:`)]`` and shouldn't get matched to patterns like `: : :` or `: ::`.

We have implemented this behavior only for when we match puncts against `tt` fragments, but not when we match puncts literally. This PR extracts the multi-character punct handling procedure into a separate method and extends its support for literal matching.

For good measure, this PR adds support for `<-` token, which is still [considered as one token in rustc](https://github.com/rust-lang/rust/blob/e3961864075eaa9e855e5eec6b4f148029684539/compiler/rustc_ast/src/token.rs#L249) despite the placement syntax having been removed.
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 26, 2024
Close rust-lang#13842

changelog: [`indexing_slicing`]: add allow-indexing-slicing-in-tests
option to be able ignore at test
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

No branches or pull requests

3 participants