@@ -556,6 +556,7 @@ impl Mutant {
556
556
}
557
557
}
558
558
559
+ #[ require_deferred_drop]
559
560
pub fn get_base ( & self , position : & usize ) -> Symbol {
560
561
match self . changes . get ( position) {
561
562
Some ( ( _from, to) ) => * to,
@@ -682,42 +683,29 @@ impl Mutant {
682
683
let ancestor = self . ancestor . clone ( ) ;
683
684
let wildtype = self . wildtype . clone ( ) ;
684
685
685
- // // we need to decrement the dirty descendants of the ancestor
686
- // // because it will be decremented when the previous node gets removed
687
- // ancestor.decrement_dirty_descendants();
688
-
689
686
// create new node
690
687
unsafe {
691
688
Mutant :: new_and_replace ( descendant_inner, ancestor, wildtype, changes, generation) ;
692
689
} ;
693
690
}
694
691
695
692
/// Defers the drop of the haplotype if it is required
696
- // fn request_deferred_drop(&self, reference: HaplotypeRef, guard: MutexGuard<AtomicIsize>) {
697
- // dbg!("Request deferred drop.");
698
- // // dbg!(self as *const Mutant);
699
- // // dbg!(&guard);
700
- // if guard.load(Ordering::SeqCst) > 0 {
701
- // dbg!(&reference);
693
+ // fn request_deferred_drop(&self, reference: HaplotypeRef, guard: &MutexGuard<usize>) {
694
+ // if **guard > 0 {
702
695
// self._drop.set(Some(reference));
703
696
// }
704
697
// }
705
698
706
699
/// Notifies that any drop needs to be deferred
707
700
fn require_deferred_drop ( & self ) {
708
701
let mut guard = self . _defer_drop . lock ( ) . unwrap ( ) ;
709
- dbg ! ( "Requiring deferred drop." ) ;
710
- dbg ! ( self as * const Mutant ) ;
711
702
* guard += 1 ;
712
703
}
713
704
714
705
/// Check if a drop has been deferred and if any other thread has requested deferred drop.
715
706
/// If no other thread has requested deferred drop, the drop will be executed.
716
707
fn inquire_deferred_drop ( & self ) -> Result < Option < HaplotypeRef > > {
717
708
let mut guard = self . _defer_drop . lock ( ) . unwrap ( ) ;
718
- dbg ! ( "Inquiring deferred drop." ) ;
719
- dbg ! ( self as * const Mutant ) ;
720
- // dbg!(self as *const Mutant);
721
709
722
710
match * guard {
723
711
0 => Err ( VirolutionError :: ImplementationError (
0 commit comments