-
Notifications
You must be signed in to change notification settings - Fork 13k
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 data API, rewrite chan_from_global_ptr #3915
Comments
getenv/setenv could also just use the RWARC's as mutexes and not create an entire task |
Would that mean all globals are *ARCs? Or would I be able to make "normal" globals, too. Because more often than not I want to avoid the overhead of an ARC. |
I don't think global @-pointers are required, but ARCs are read-only, and RWARCs add overhead, this is my main concern. I think this and #553 should go hand in hand: mut-globals which are declared as unsafe should not be RWARC-guarded. I'd really like to use mutable globals, but I would definitely not use RWARCs in my current usecases. |
Rewriting |
@brson Still relevant? |
This is done. |
switch custom target JSON test to a less exotic target We used to test an AVR target here, but while it is nice to test a 16bit target, it is also currently the case that rustc CI does not even check that libcore builds on a 16bit target -- and we don't want Miri to be in the game of maintaining that support. (See rust-lang#130818.) So let's use a tier 2 target as the basis for testing a custom JSON target. (FWIW, we also test wasm32-wasip2 which is tier 3, but I expect it will become tier 2 Soon-ish.)
It would be similar to the local data API, except that values are probably RWARCs for mutable data and ARCs for immutablel data.
Then
chan_from_global_ptr
could be expressed in terms of the global data API, storing a pipe-based channel, which would get it away from usingcore::comm
.linenoise also needs a global mutex, which this would provide.
There's some question about where the constructor runs, but the API could just hand you a
RWARC<Option<T>>
and let you figure it out - presumably anybody using this API would encapsulate it in something else. The hard part is deciding when to do the cleanup and whether to allow destructors. The obvious thing I can think of is to have a weak task do it, and weak tasks have to know not to rely on global data during shutdown.Like the local data API it would be unsafe until we have a good way to name the key.
Related to #553
The text was updated successfully, but these errors were encountered: