brk_multithreaded.rs 330 B

123456789101112131415161718192021
  1. extern crate ralloc;
  2. use ralloc::sys::inc_brk;
  3. use std::thread;
  4. fn main() {
  5. let mut threads = Vec::new();
  6. for _ in 0..1000 {
  7. threads.push(thread::spawn(|| {
  8. unsafe {
  9. inc_brk(9999).unwrap();
  10. }
  11. }));
  12. }
  13. for i in threads {
  14. i.join().unwrap();
  15. }
  16. }