Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ impl<'thread> Worker<'thread> {
let our_packet = Arc::new(packet);
let their_packet: Arc<dyn UnitOfWork + Send + Sync> = our_packet.clone();
// SAFETY: we merely prolong the lifetime of the borrow. This lifetime is threaded into the ClaimedWorker struct.
let their_packet = unsafe { Arc::from_raw(Arc::into_raw(their_packet) as *mut _) };
let their_packet = unsafe {
Arc::from_raw(std::mem::transmute::<
*const (dyn UnitOfWork + Send + Sync + '_),
*const (dyn UnitOfWork + Send + Sync + 'static),
>(Arc::into_raw(their_packet)))
};
let work = WorkItem::Task(their_packet);
let barrier = self.control.send(work);
ClaimedWorker {
Expand Down