File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11//! Integration test for ring buffer + support core
22//!
3- //! Tests the full AMO pipeline with concurrent producer/consumer.
3+ //! Tests the full AMO pipelines with concurrent producer/consumer.
44
55#![ cfg( feature = "std" ) ]
66
@@ -42,9 +42,11 @@ fn test_producer_consumer_threads() {
4242
4343 let producer = thread:: spawn ( move || {
4444 for i in 0 ..100 {
45+ // Allocate real memory so support_core can free it safely
46+ let ptr = unsafe { libc:: malloc ( 16 ) as * mut u8 } ;
4547 let payload = FreeBlockPayload {
46- ptr : i as * mut u8 ,
47- size : i * 16 ,
48+ ptr,
49+ size : 16 ,
4850 size_class : ( i % 16 ) as u8 ,
4951 } ;
5052 let entry = RingEntry :: new (
@@ -60,7 +62,7 @@ fn test_producer_consumer_threads() {
6062 } ) ;
6163
6264 producer. join ( ) . unwrap ( ) ;
63- thread:: sleep ( Duration :: from_millis ( 50 ) ) ;
65+ thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
6466
6567 running. store ( false , std:: sync:: atomic:: Ordering :: Relaxed ) ;
6668 consumer. join ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments