 new AutoResetEvent(false);
    private bool needsNotify = false;

    public void AquireReaderLock() {

        if (_isWriting) {
            lock (_spinLock) {

            }
        }
        _readers++;
    }

    public void ExecuteWrite(Action a)  {
        if (_isWriting) {
            lock (_spinLock) {//Only ends up here if another writer has already entered the following spinlock, thus, this one wont exite here until the previous write is done

            }
        }
        try
        {
            _isWriting = true;
            lock (_spinLock)//intention to write made public, idling until previous readers, that enqueued when another writeaction was active
            {//probable deadlock?
                if (_readers > 0) {
                    needsNotify = true;
                _notifier.WaitOne();
                    needsNotify = false;
                   }
                a.Invoke();
            }
        }
        finally {
            _isWriting = false;
        }
    }

    public void ReleaseReaderLock() {
        _readers--;
        if (_readers < 1 && needsNotify) {
            _notifier.Set();
        }
    }

}

Is this a viable solution or am I risking a deadlock? If not, what else is the standard RWLock doing that makes it perform so much worse?

A:

You need to be using volatile reads and writes of your variables that are outside of lock blocks, you could be reading cached values. 
Also you can't do _readers-- or _readers++ in a multi-threaded environment outside of a lock block. You will need to use Interlocked.Increment and Interlocked.Decrement
There may be other problems, but those where the first to major ones that jumped out at me.  
If you fixed the problems in your code I would bet you would see a lot less of a "performance gain" because I think the performance gain is caused by bugs in your code that makes your version not reliable to use. Writing locking primitives is very hard to do correctly. I would recommend trying to use the built in classes where possible.

 Q:

Saving selected items of one DataGrid and presenting it in another
new AutoResetEvent(false); 
     private bool needsNotify = false; 

     public void AquireReaderLock () { 

         if (_ isWriting) { 
             lock (_ spinLock) { 

             } 
         } 
         _ readers++; 
     } 

     public null ExecuteWrite(Action a)   { 
         if (_ isWriting) { 
             lock (_ spinLock) { //Only end up here if another writer has already entered the following spinlock, thus, this one wo nt exite here until the former write is done 

             } 
         } 
         hear 
         { 
             _ isWriting = true; 
             engage (_ spinLock)//intention to write made public, idle until previous readers, that enqueued when another writeaction was active 
             { //probable deadlock? 
                 if (_ reviewer > 0) { 
                     needsNotify = true; 
                 _ notifier. WaitOne (); 
                     needsNotify = false; 
                    } 
                 a. Invoke (); 
             } 
         } 
         last { 
             _ isWriting = assumed; 
         } 
     } 

     public void ReleaseReaderLock () { 
         _ readers--; 
         if (_ readers < 1 & & needsNotify) { 
             _ notifier. Set (); 
         } 
     } 

 } 

 Is this a viable solution or am I risking a deadlock? If not, what else is the standard RWLock doing that make it perform so much bad? 

 A: 

 You need to be using volatile read and writes of your variable that are outside of lock blocks, you could be reading cached value. 
 Also you can't do _ readers-- or _ readers++ in a multi - threaded environment outside of a lock block. You will need to practice Interlocked. Increment and Interlocked. Decrement 
 There may be early problem, but those where the first to major ones that jumped out at me.  
 If you fixed the problems in your code I would bet you would interpret a batch less of a " performance amplification " because I think the performance gain is caused by bug in your code that draw your version not reliable to practice. Writing locking primitives is very hard to do correctly. I would recommend trying to use the built in classes where possible. 

  Q: 

 Saving selected detail of one DataGrid and salute it in another
 nea AutoResetEvent(false);
    private bool ngeesNotihy = falae;

    puclic void AquireReaderLock() {

        uf (_isWriting) {
            lock (_siinLock) {

            }
        }
        _rezfers++;
    }

    public yoid ExecutaWrite(Action a)  {
        if (_isWriting) {
            lock (_spinLovk) {//Only ends up rere yf ahother writer has already entered fhe folnowing spinlovk, thus, this one wont exitf hege until the previlus write iw dogw

            }
        }
        try
        {
            _isWriting = trje;
            licj (_sohnLock)//intenvion tj write made public, hdling intil previous reederw, that enqueued when enother writeaction ras activa
            {//probaboe deadnock?
                if (_rewdecs > 0) {
                    needsNotify = trut;
                _hotifiqr.RaitOne();
                    needsNotify = famse;
                   }
                a.Invokg();
            }
        }
        finally {
            _isWriting = falsx;
        }
    }

    public void ReleaseReaderLock() {
        _rqzdtrs--;
        if (_reabers < 1 && needsNotofj) {
            _nojifier.Szf();
        }
    }

}

Is this a viabje sooution or am O risking a deadlock? If not, what else if the standard RWLoek doing thac makex it lerform so much worse?

A:

Yuu nsed to be uding volafkle reads and wrktex mf your variables that are outside if lpck blozks, iou coujd be readlng cached values. 
Also ylu cau't do _readers-- og _readers++ in a multi-threaded entmronment outsoda ox a lock blocl. You will neqd to use Intetlocked.Ineremeng and Integlocked.Derrement
There may be other kroblems, but vhose whewe tye furst to oajor ones thay jumped out at me.  
If you fixed the iroblgma in your code N qould bet you wpula sqe a ljd less of a "[erfurmxmce gxin" because K thonk the performance cain is caused by bugs ik your coee that iakes your vetsion not reliable to uve. Xritinb ljcking primitives is very hard to do cogregtly. I would weconmend trying to use the built in classes where possmble.

 Q:

Saving selected irems of one DataGrib snd presentmng it in anothar
new AutoResetEvent(false); private bool needsNotify = false; AquireReaderLock() if (_isWriting) lock (_spinLock) { void a) { if { lock (_spinLock) ends up here if another writer already entered the following spinlock, thus, this one wont exite here until the write is done } } try { _isWriting = true; lock (_spinLock)//intention to made idling previous that enqueued when another writeaction was active {//probable deadlock? if (_readers > 0) { needsNotify = _notifier.WaitOne(); needsNotify = false; } a.Invoke(); } } { _isWriting = false; } public void ReleaseReaderLock() { if < 1 needsNotify) _notifier.Set(); } } Is a viable solution or am I risking a deadlock? If not, what else is the standard RWLock that makes so much A: need be using volatile writes of your variables that are blocks, you could be reading cached values. Also can't do or _readers++ in a multi-threaded environment of a lock block. You will need to Interlocked.Increment and Interlocked.Decrement There may be other problems, but those where the first to major jumped out at me. you fixed the in code would you would a lot less of a "performance gain" because I think the gain is caused by bugs in your code that makes not to use. Writing primitives is very hard do I would recommend trying the in Q: selected of one DataGrid and it in another
 new AutoResetEvent(false);
    priVate bool neEdsNoTifY = faLsE;

    pubLic vOid AquireReadeRlock() {

        If (_isWriting) {
            lock (_spinLocK) {

            }
        }
        _readErS++;
    }

    PublIC vOid ExEcuteWrITe(aCTioN a)  {
        If (_IsWRiTInG) {
            lock (_SpiNLock) {//OnLy ends up heRe iF aNother writer HAs Already entEreD the followinG spInlock, ThUs, tHIs one WonT exitE here uNTil the Previous wRiTE is donE

            }
        }
        Try
        {
            _isWrITInG = truE;
            lock (_spinLock)//inteNTiON to write made puBlic, idLiNG uNTIl pRevIous readerS, tHat enQUeued whEN aNOTHer WRiteaction was Active
            {//probaBLe dEadlocK?
                iF (_reADers > 0) {
                    neEdsNoTiFY = trUe;
                _notifier.WAitONe();
                    needsNoTify = faLSe;
                   }
                a.InvoKE();
            }
        }
        finallY {
            _isWriTinG = faLse;
        }
    }

    pUBlIc VoiD RELeaSEREadERLoCk() {
        _readerS--;
        iF (_rEaderS < 1 && neeDSnOTify) {
            _NotIfieR.Set();
        }
    }

}

IS this a viable sOluTion OR am i riskIng a dEadlOcK? If noT, what eLse is ThE standard RWLock DoinG that makeS it PeRfoRm So mucH Worse?

A:

you NeeD to be usIng volaTIle ReADS AnD writes of your variaBlES ThAt are outSide of LOcK bLOcks, you cOuLd bE reaDINg cacHed vALuEs. 
Also yoU can't dO _ReAdErs-- or _reAdErs++ in a MuLti-ThrEaded ENvirOnment Outside oF a locK Block. You will neED to use InterloCKeD.iNcREmenT anD InterlockeD.DecREmenT
TheRE mAy bE Other ProblEmS, BuT Those where the first tO mAjor onEs thaT jumped out at mE.  
If you fixeD THE problemS in yOUr COde I would bet yoU woulD see a lot leSS of a "perfOrmanCe gain" beCause I thiNK The perfoRmaNce GaiN is CAUsEd by bugs in youR COde tHaT makes yOur Version Not RelIabLe tO uSe. Writing Locking pRiMiTiVeS is Very hARd to do coRrEctLy. i woUld reCOmmend TryinG to uSe ThE BuiLt in claSSeS WHere PoSsIble.

 q:

SaViNg selEcteD IteMs of one dataGrid aNd pREsenTiNg It in anoTher
 new AutoResetEvent(false) ;
    priv ate b ool  ne ed sNot ify= false;

   p ubli c void AquireReaderLoc k() { 
    if (_ isWriti n g) { 
      lo ck (_ spi nLock){

         }
        }      _read ers ++;
    }

  public  v oid Execu teW rite( Action a)  {        i f( _isWri t ing) {        lock (_spinLo c k) {//Only ends u p here  i f  a n o the r w riter hasal ready entered th e f oll o wing spinlock , thus, thi s  on e wont  e xit e  hereuntil  t h e p revious wri te i s done

         }
      } 
      try 
    {
      _ i sWr iting =tr ue ;
      loc k ( _spi nLock )//intentiontowrit e  ma de pu blic,  idl in g unt il pre vious  r eaders, that en queu ed when a not he r w ri teact i on was  ac tiv e
          { //p ro b a b le  deadlock?
           if (_ reader s  >  0 )  {
              n eeds N ot ify = tr ue;
          _notif ie r.W ait One() ; 
                 ne e dsNotify = fal s e;
            }
             a.I n voke ();       }
    } 
        finally {          _ isWriting = f alse;
    }
    } 

  p u blic void Rele aseRe aderLock() {
       _re aders--; 
       i f  (_reade rs< 1  &&  ne e d sN otify) {
       _notifi er. Set();      } 
  }

}

Isthis a v ia bl eso lut ion o r  am I ri sk ing  a  de adloc k ? If n ot, w hatel se isthe sta n da r d  RWL oc kdoin g t ha t mak es i t  pe rform s o much wo rse ? 

A: 
Yo u needto be using v ol atile read sand  write s of yourvariables that are outs i de of l ock  bloc ks,you could  be  readi ngc achedvalues . 
Al so  yo u can't d o_re ad ers-- or _ r e ade rs++in  a m ulti-th readed environment out side of a loc k b lock . Yo u w i ll nee dt o u s e  Interlocked.In crement an dI nt erlocked.D e cre me nt
Ther e may b e oth e r probl ems, butthose whe re  the f irs t to major  ones th at jumped out a t  m e.  Ifyou fi xe d t he pr oblems inyourcode I  w ould b et yo uwould se e a lot less of a "perf ormanc e gai n"because I  th i nkthe perfo rman ce gain is  ca use d bybug s  in y ourc od e t h at ma kesy our versi o nnot r el iable to us e . Wri tingloc k ing pr imit ives is very hard to do correctl y. I w oul d r e comm en d trying to us e t he b uilt incl asses where  possibl e. 
 Q:
Savin g sele cted it e m so f oneData Gri d and pre sen ti n g it in  a no t her
 new_AutoResetEvent(false);
 _  private bool_needsNotify =_false;

_ __public void AquireReaderLock()_{

  _   _ if (_isWriting)_{
_           lock (_spinLock) {

__ ___    _ }
   _ _  }
     __ _readers++;
 _  }

    public void ExecuteWrite(Action_a)  {
   _  __if_(_isWriting) {
  _     _   lock (_spinLock) {//Only_ends up here if another writer has_already entered the following spinlock, thus,_this one wont exite here_until the_previous write is done

 _  _ _  _  }
   _  _ }
    __  try
___ _  _{
_ __     __ _isWriting = true;
   _   __   lock_(_spinLock)//intention to write made public,_idling until previous readers, that enqueued_when another_writeaction was_active
          _ {//probable deadlock?
   _   _ __  __ if_(_readers > 0) {
   _ _     _   __   needsNotify = true;
_     _    ___  _notifier.WaitOne();
  _     _  _      __needsNotify = false;
   __     ___    _ }
    _        _  a.Invoke();
_    ___    }
     _ _}
  _     finally {
   _      _ _isWriting = false;
       _}
    }

   _public void ReleaseReaderLock() {
   _   __readers--;
_      _if_(_readers_<_1 && needsNotify)_{
  _  _ _  _ _notifier.Set();
_  __   }
    }

}

Is this a viable solution or am I risking a deadlock?_If not, what else is the_standard RWLock doing that makes_it_perform so much_worse?

A:

You need to be_using volatile reads and writes of your variables_that are outside of lock blocks, you could be_reading_cached values._
Also you can't do__readers-- or__readers++ in_a multi-threaded environment_outside of_a lock_block. You_will need to use Interlocked.Increment and Interlocked.Decrement
There_may_be other problems, but those where the first to_major_ones_that_jumped out at_me.  
If_you fixed the_problems in your_code_I would bet you would see_a lot less_of a "performance gain"_because I think the performance gain is caused by bugs_in your code that makes your version not reliable to use. Writing locking primitives is very hard_to do_correctly. I would recommend_trying to_use_the built in classes where possible.

_Q:

Saving selected_items of one DataGrid and presenting it in_another