mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-05-29 18:08:56 -06:00
Make thread utilities unsafe
This commit is contained in:
4
examples/allocation_loop/Cargo.lock
generated
4
examples/allocation_loop/Cargo.lock
generated
@@ -4,12 +4,12 @@
|
||||
name = "allocation_loop"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bdwgc-alloc 0.1.1",
|
||||
"bdwgc-alloc 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bdwgc-alloc"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
4
examples/dynamic_threads/Cargo.lock
generated
4
examples/dynamic_threads/Cargo.lock
generated
@@ -2,7 +2,7 @@
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "bdwgc-alloc"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -11,7 +11,7 @@ dependencies = [
|
||||
name = "dynamic_threads"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bdwgc-alloc 0.1.1",
|
||||
"bdwgc-alloc 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -11,7 +11,7 @@ fn main() {
|
||||
|
||||
loop {
|
||||
let handle = std::thread::spawn(move || {
|
||||
Allocator::register_current_thread().unwrap();
|
||||
unsafe { Allocator::register_current_thread().unwrap() }
|
||||
|
||||
let mut _n =
|
||||
unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) };
|
||||
@@ -20,7 +20,7 @@ fn main() {
|
||||
_n = unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }
|
||||
}
|
||||
|
||||
Allocator::unregister_current_thread();
|
||||
unsafe { Allocator::unregister_current_thread() }
|
||||
});
|
||||
|
||||
handle.join().unwrap();
|
||||
|
||||
4
examples/static_threads/Cargo.lock
generated
4
examples/static_threads/Cargo.lock
generated
@@ -2,7 +2,7 @@
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "bdwgc-alloc"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -16,7 +16,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
name = "static_threads"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bdwgc-alloc 0.1.1",
|
||||
"bdwgc-alloc 0.2.0",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
|
||||
@@ -10,7 +10,7 @@ fn main() {
|
||||
unsafe { Allocator::initialize() }
|
||||
|
||||
let handle = std::thread::spawn(move || {
|
||||
Allocator::register_current_thread().unwrap();
|
||||
unsafe { Allocator::register_current_thread().unwrap() }
|
||||
|
||||
let mut _n = unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user