Comments (2)
Other options include:
- Actually using a condvar here.
- The reason we're not using one now is that it would only be used in
take
, and would mean adding a mutex/condvar pair to every slot. This would mean two heap allocations per slot, plus increasing the size of each slot itself by 32 bytes (on linux/x86_64, see https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=5c07e4a6cbf9e3755ff5543a9062d6d9) - Using a mutex/condvar pair would also be an obstacle to porting this code to
no_std
, which is an eventual goal...although we could just make thetake
method require std.
- The reason we're not using one now is that it would only be used in
- Just remove this API entirely in 0.1. I'm not sure how much of a use-case there is for it OTTOMH (
tracing-subscriber
doesn't use it).
from sharded-slab.
Another option is that we could consider adding a proper backoff here. We would still be spinning, but could have the thread sleep while spinning rather than just emitting pause
instructions. That would be an obstacle to porting to no_std
, but this code currently doesn't work on no_std
, and we could just feature flag it.
This might be a good compromise between not burning CPU in a tight spin loop and having to allocate a mutex/condvar pair for every slot.
from sharded-slab.
Related Issues (20)
- Some way to query size of pool
- panic in Config RefCount::decr HOT 5
- Getting owned handles via pool results in unbounded memory growth.
- Build error: use of unstable library feature 'renamed_spin_loop' HOT 4
- fall back gracefully when max thread IDs are reached HOT 2
- Can I set Config::RESERVED_BITS to 32?
- All uses of the word "slab" on docs.rs link to the loom repository instead
- Migrate from lazy_static to once_cell HOT 1
- Slab::unique_iter panics when the slab is empty HOT 1
- Why does TID require one extra bit? HOT 2
- #![no_std] support HOT 2
- Document semantics of Slab::unique_iter HOT 2
- Draining iterator HOT 1
- Serde support HOT 6
- sharded-slab v0.1.5 tests fail to compile on 32-bit x86 HOT 5
- Unbounded memory growth with RESERVED_BITS HOT 4
- Return key immediately on insert duplicate value
- error when building HOT 6
- Provide `Entry` that can cross the `.await` point HOT 1
- Poisoned thread leads to confusing panic in `Pool::current`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharded-slab.