Skip to content

Commit 48b9e82

Browse files
committed
[context] Use traits instead of cfg! to handle singleton collectors
Wheter the **implementation** of zerogc-simple is a singleton is still controlled by features, but the public API of the context crate is not. This is the first step on the way towards making the implemnentation more configurable. Now whether or not a collector is a singleton is handled by if they implement 'SingletonCollector' and if 'RawSimpleCollector::Singleton' is true/false. Now we can check compilation for both multiple-collectors and singleton at the same time :) This way we can have some collectors that are singletons and some that are not within the same compilation units. With the old feature-based approach, making one collector have multiple instances forced all of them too. Eventually, we need to support sync/nosync the same way.
1 parent 1d3f95c commit 48b9e82

File tree

5 files changed

+270
-175
lines changed

5 files changed

+270
-175
lines changed

libs/context/Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ slog = "2.7"
2020
[features]
2121
default = [
2222
"sync", # Thread-safety by default
23-
"multiple-collectors", # By default, allow multiple collectors
2423
]
2524
# Allow multiple threads to access the garbage collector
2625
# by creating a seperate context for each.
@@ -30,10 +29,4 @@ sync = [
3029
"parking_lot",
3130
"crossbeam-utils"
3231
]
33-
# Allow multiple collectors to exist at once
34-
# Otherwise, there's a single global collector (useful in VMs)
35-
#
36-
# Even if multiple collectors are enabled, pointers from
37-
# one collector can't be safely mixed with other collectors.
38-
multiple-collectors = []
3932

0 commit comments

Comments
 (0)