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

@safe setter for driver #15

Open
MartinNowak opened this issue Jun 17, 2018 · 6 comments
Open

@safe setter for driver #15

MartinNowak opened this issue Jun 17, 2018 · 6 comments

Comments

@MartinNowak
Copy link
Collaborator

Track number of open files/sockets in driver to allow @safe setting/swapping of the IO Driver.

@schveiguy
Copy link
Owner

You may be able to migrate the open files as well, if you pull them out of the current driver as file descriptors, and open them in the new driver.

@MartinNowak
Copy link
Collaborator Author

That meant keeping track of all open files within the driver, not a reasonable option. Also driver changes don't seem to have a use-case.
Furthermore an async driver would mark sockets as non-blocking during opening, migrating such flags seems unfeasible either.

@schveiguy
Copy link
Owner

I actually meant manually, not automatically . I’m thinking of the standard handles which you don’t want to close.

@schveiguy
Copy link
Owner

Regarding changing flags, the driver already supports opening with a file descriptor, so it has to deal with that already.

@schveiguy
Copy link
Owner

I agree that changing drivers mid-program doesn't really have a great use case. However, it should be supported on entry to main.

@anon17
Copy link

anon17 commented Mar 15, 2019

btw, you can store shared driver in TLS:

struct LocalShared(T)
{
	shared T value;
	alias value this;
}
LocalShared!Driver _driver;

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