diff --git a/src/event_queue.rs b/src/event_queue.rs index 2e9c9a2..b8b0873 100644 --- a/src/event_queue.rs +++ b/src/event_queue.rs @@ -82,7 +82,7 @@ impl EventQueue pub fn with_capacity(new_capacity: u32) -> Pin>{ assert!(S::MIN_CHUNK_SIZE <= new_capacity && new_capacity <= S::MAX_CHUNK_SIZE); - let this = Arc::pin(Self{ + let this = Arc::new(Self{ list: Mutex::new(List{ first: null_mut(), last: null_mut(), @@ -101,13 +101,13 @@ impl EventQueue let node = DynamicChunk::::construct( 0, StartPositionEpoch::zero(), &*this, new_capacity as usize); - unsafe { - let event = &mut *(&*this as *const _ as *mut EventQueue); - event.list.get_mut().first = node; - event.list.get_mut().last = node; + { + let mut list = this.list.lock(); + list.first = node; + list.last = node; } - this + unsafe{ Pin::new_unchecked(this) } } #[inline]