mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-10-25 09:23:18 -06:00
Add static threads example
This commit is contained in:
1 parent
1d5c505752
commit
451ba6cec3
3 files changed
+54
No files matched your search
@@ -0,0 +1,23 @@
|
||||
extern crate bdwgc_allocator;
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL_ALLOCATOR: bdwgc_allocator::Allocator = bdwgc_allocator::Allocator;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
bdwgc_allocator::Allocator::initialize();
|
||||
bdwgc_allocator::Allocator::start_gc();
|
||||
}
|
||||
|
||||
let handle = std::thread::spawn(move || {
|
||||
bdwgc_allocator::Allocator::register_current_thread().unwrap();
|
||||
|
||||
let mut _n = bdwgc_allocator::Allocator::alloc(2 ^ 8);
|
||||
|
||||
loop {
|
||||
_n = bdwgc_allocator::Allocator::alloc(2 ^ 8)
|
||||
}
|
||||
});
|
||||
|
||||
handle.join().unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user