-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 global variables to unsafe #553
Comments
Now that libuv is almost here we're going to need some way to set up tasks whose handles are accessible globally. I would like to pursue both global and task-local data for 0.3. |
pcwalton convinced me that we shouldn't take this step lightly. for my current use cases we can add some privileged runtime functions |
We discussed this on IRC today and came to the conclusion (I think, @brson please correct me if I'm misrepresenting you here) that unsafe globals would be ok if we avoid any sort of static initializer code. That is, only permit globals initialized as constants, and make all access to them unsafe. Then we could build a variety of safer abstractions on top (lazily-initialized singletons, single-writer / multi-reader dataflow variables, etc.) IOW I still think this is something we should be getting to. Agreed? |
Agreed, but my impression was that you were sort of trying to sidestep the global issue by using |
Ok, spent a few more hours sketching and came up with slightly fighter design. Criticism / modification welcome.
|
This sounds good to me. |
Sounds reasonable. I think the I do think a deep read-only type operator is useful but there are various issues to consider and I think it takes some design work, particularly around classes/methods/other things that are still in flight. I have been thinking about such an operator for a while, partially modeled on Javari, for the purposes of deterministic, in-process parallelism, but I haven't gotten around to writing much of it out... |
Is this subsumed by TLS? Or do things truly need to be accessible cross-task? |
|
See also this thread: |
There are a number of global mutexes and pointers in the runtime code these days that can all be converted to Rust once this is done. |
Get CI working again A few changes have necessitated some updates on our end
Document repr packed(N).
We should support simple global variables. No before main constructors, just plain variables.
The text was updated successfully, but these errors were encountered: