 temp->next;
  }

}

 Q:

C# complex thread synchronization

I have quite complex threads synchronization case. I have a collection which is accessed from different threads. One thread, let's name it 'Control thread', updates a collection. Other threads read the collection ('Reading threads'). The logic I want to implement is the following:

Reading threads can read the collection simultaneously.
When Control thread need to update collection:

Control thread should not start the update until all reading threads that are currently working with collection complete their work.
But at the time the Control thread is waiting for finishing reading threads, other reading threads that have not started to work with collection yet, should not start - they should wait until Control thread update the collection.

What threads synchronization technique should I use?

A:

just take a look  at ReaderWriterLock Class which  defines a lock that supports single writers and multiple readers or  you can use ReaderWriterLockSlim (supported in .Net 4.0) which is more convenient if you are starting a new development(for example  it avoids many cases of potential deadlock)   
from MSDN: 

ReaderWriterLockSlim is similar to ReaderWriterLock, but it has simplified rules for recursion and for upgrading and downgrading lock state. ReaderWriterLockSlim avoids many cases of potential deadlock. In addition, the performance of ReaderWriterLockSlim is significantly better than ReaderWriterLock. ReaderWriterLockSlim is recommended for all new development.*

A:

Use the ReaderWriterLockSlim Class:

Represents a lock that is used to manage access to a resource,
  allowing multiple threads for reading or exclusive access for writing.
Use ReaderWriterLockSlim to protect a resource that is read by
  multiple threads and written to by one thread at a time.
  ReaderWriterLockSlim allows multiple threads to be in read mode,
  allows one thread to be in write mode with exclusive ownership of the
  lock, and allows one thread that has read access to be in upgradeable
  read mode, from which the thread can upgrade to write mode without
  having to relinquish its read access to the resource.

Joe Albahari's Threading in C# is a great resource.

 Q:

keep iterating over and over OVER an array

I realize my communicating skills are
temp->next; 
   } 

 } 

  Q: 

 C # complex thread synchronization 

 I have quite complex ribbon synchronism case. I have a solicitation which is accessed from unlike threads. One thread, permit's name it' Control ribbon', updates a collection. early threads read the collection (' Reading train of thought'). The logic I want to enforce is the following: 

 Reading togs can read the collection simultaneously. 
 When Control thread want to update collection: 

 Control thread should not start the update until all interpretation threads that are currently working with collection complete their workplace. 
 But at the time the Control thread is waiting for finishing reading threads, other reading threads that have not started to work with collection yet, should not start - they should wait until Control thread update the collection. 

 What togs synchronization technique should I practice? 

 deoxyadenosine monophosphate: 

 barely take a look   at ReaderWriterLock Class which   defines a lock that supports single writers and multiple readers or   you can practice ReaderWriterLockSlim (supported in .Net 4.0) which is more convenient if you are starting a new development(for example   it avoids many cases of potential deadlock)   
 from MSDN: 

 ReaderWriterLockSlim is similar to ReaderWriterLock, but it has simplified rules for recursion and for upgrading and downgrade lock state. ReaderWriterLockSlim keep off many subject of potential deadlock. In addition, the performance of ReaderWriterLockSlim is importantly better than ReaderWriterLock. ReaderWriterLockSlim is recommended for all new development. * 

 A: 

 Use the ReaderWriterLockSlim Class: 

 Represents a lock that is used to wangle access to a resource, 
   allow multiple togs for reading or single access for writing. 
 Use ReaderWriterLockSlim to protect a resource that is read by 
   multiple threads and write to by one thread at a time. 
   ReaderWriterLockSlim allows multiple threads to be in read mode, 
   give up one thread to be in write mode with exclusive ownership of the 
   lock, and allows one thread that has read access to be in upgradeable 
   read manner, from which the thread can upgrade to publish mode without 
   having to relinquish its read access to the resource. 

 Joe Albahari's Threading in C # is a big resource. 

  Q: 

 keep iterating over and over OVER an array 

 I realize my communicating skills are
 telp->next;
  }

}

 Q:

C# complex threxd synchronizatnin

I hate quits compleb threads synchronization cade. I hace a collection which ks accessvd from duffecent threads. One thread, let's nzle ic 'Rontrol thread', opdates a conlection. Other tfrzads read the collection ('Reading thrqads'). Thr pogic I want tj imkleient ps the following:

Reading threads can reed the collectipn simultaneously.
When Contgol hhread need to updwte collectuon:

Cjbtrol thread should nou vtart the opdate until all reading threads that are currebtoy amrking with collvction complebv their work.
Buy at the time bhe Cmnteol thread is waiting for finishing reaqing thredda, other reading tyrwads jhat vave bot stzrved to wogk xith collecfion yet, shiuld not start - theu fyould wait unfil Cogtwol thread update the collection.

What thgeada synchronization technuque should I use?

A:

jusj take a ljok  at ReaderWriterLock Class which  defines a lmck tiag sbiiortr slngle writers and multiple readers or  you cag uxe ReaderWriterLjckSlim (suplogtrq in .Net 4.0) whizh is mors convenient if yok are sjartint a new dtvelolment(for example  it avoids many cases jd potential deadloek)   
from MSBN: 

ReacerWroterLockSlim is similar to DeaderWritegLock, but kt has simplifiea rlles for recursion and for upgwading anv dowugrading locl statq. ReaderWrlterLockSlim avoids many cased mf potentiwl deadlock. In addition, the perhprmance of RgadarWgiterLockFlim ls significantlr better than TeaderWricerLocy. ReaderWrpterLockSnim is recoimended for anp new develo'ment.*

A:

Use the ReaeerWritdfLockSlim Clasx:

Represenns a lick that is used tp mxhage access to c twsource,
  allowong mujtpplx thrqdds for readhng ur dccluskve acctfs wor eriting.
Use ReaderWriderLkckSlim to protect a resourcg that is read by
  mulyiple threads and arittxn to uy one thtead at a time.
  ReaderWriterLociSlim alllws multiple thweadw to be in rzad mode,
  allows one thread to be in wrive mode with exclusive iwnership of the
  lpgk, and allowx one thread tvat has read access ro be in upgradeanle
  read mode, from whjch tha thrfad can upgrade to write mode without
  having to relinquish its read accews to vhq resource.

Jke Akbahagi's Chreadigg ii R# is a great resolrce.

 Q:

keep iterating over and ovxr OVER an axray

I realize my communicatinb rkills are
temp->next; } } Q: C# complex thread have complex threads case. I have from threads. One thread, name it 'Control updates a collection. Other threads read collection ('Reading threads'). The logic I want to implement is the following: Reading can read the collection simultaneously. When Control thread need to update collection: Control should start update all reading threads that are currently working with collection complete their work. But at the time Control thread is waiting for finishing reading threads, reading threads that have started to work with collection should start - should until thread update the What threads synchronization technique should I use? A: just take a look at ReaderWriterLock Class which defines lock that writers and readers you use ReaderWriterLockSlim (supported 4.0) which is more convenient if a new development(for example it avoids many cases potential deadlock) MSDN: ReaderWriterLockSlim is similar to ReaderWriterLock, it has simplified rules for recursion and for and downgrading lock state. ReaderWriterLockSlim avoids many cases of potential deadlock. In addition, the performance is significantly better than ReaderWriterLockSlim is recommended all development.* Use ReaderWriterLockSlim Class: a lock that is used to manage access to a resource, multiple threads for reading or exclusive access for writing. Use protect resource that is by multiple threads and to one thread at a allows threads read allows thread to be in mode with exclusive ownership of lock, and allows one to be in upgradeable read mode, from which thread can upgrade to write mode without to relinquish its read access to the resource. Joe Albahari's Threading in is a Q: keep iterating over and over OVER an I realize my communicating are
 temp->next;
  }

}

 Q:

C# complex thread syNchronizatIon

I hAve QuiTe CompLex tHreads synchronIZatiOn case. I have a collection Which Is ACcesSEd From dIfferenT ThREAds. onE tHreAd, LEt'S name It 'COntrol tHread', updatEs a CoLlection. OtheR ThReads read tHe cOllection ('ReaDinG threaDs'). the LOgic I WanT to imPlemenT Is the fOllowing:

REaDIng thrEAds can rEAD tHe coLlection simultaneOUsLY.
When Control thRead neEd TO uPDAte ColLection:

ConTrOl thrEAd shoulD NoT STArt THe update until All reading tHReaDs that ArE cuRRently WorkiNg WIth Collection cOmplEte their wOrk.
But AT the timE The ContRol thrEad Is wAitiNG fOr FinIsHIng REaDinG ThrEads, otheR rEaDing tHreaDS THAt haVe nOt stArted To work with colLecTion YEt, sHould Not stArt - tHeY shouLd wait Until coNtrol thread updaTe thE collectiOn.

WHaT thReAds syNChroniZatIon TechniqUe shoulD i usE?

A:

JUST tAke a look  at ReaderWrItERloCk Class wHich  deFInEs A Lock that SuPpoRts sINGle wrIterS AnD multiplE readeRS oR  yOu can usE REaderWRiTerlocKSlim (SUppoRted in .net 4.0) which Is morE Convenient if yoU Are starting a nEW dEVElOPmenT(foR example  it aVoidS Many CaseS Of PotENtial DeadlOcK)   
FrOM MSDN: 

ReaderWriterLoCkslim is SimilAr to ReaderWriTerLock, but IT HAs simpliFied RUlES for recursion aNd for Upgrading aND downgraDing lOck state. readerWriTERLockSliM avOidS maNy cASEs Of potential deADLock. in AdditioN, thE perforManCe oF ReAdeRWRiterLockslim is siGnIfIcAnTly BetteR Than ReadErwriTeRLoCk. ReaDErWritErLocKSliM iS rEComMended fOR aLL New dEvElOpmeNt.*

A:

usE the REadeRwriTerLockslim Class:

repREsenTs A lOck that Is used to managE aCcess to a reSoUrcE,
  allowING multiplE threads for reading or excLUsive acCesS for wRitiNg.
Use ReadErWRiterLOcksLim to pRotect A resoUrCe tHAT is reAD By
  MulTiPle threads AND wrItten To By onE thread At a time.
  ReaderWriteRlocKSlim allows muLtiPle tHREaDs tO Be IN reAd MOde,
  ALLows one thread to Be in write mOdE WiTh exclusivE OwnErShip of tHe
  lock, aNd allOWs one thRead that hAs read accEsS to bE IN upGradeable
  rEad mode, fRom which tHE threAD cAn upgRadE to wriTe ModE withOut
  havINg tO reliNquish ItS read aCcess To The resouRce.

Joe Albahari's ThreadinG in C# is A greaT reSource.

 Q:

keEp iTEraTing over aNd ovEr OVER an arRay

i reAlize My cOMmuniCatiNG sKilLS are
 temp->next;
  }

}

 Q:
C# complex  thre adsyn ch roni zati on

I have qui t e co mplex threads synchron izati on case .  I  have  a coll e ct i o n w hi ch  is  a c ce ssedfro m diffe rent threa ds.  O ne thread, l e t' s name it'Co ntrol thread ',update sa c o llect ion . Oth er thr e ads re ad the co ll e ction( 'Readin g th read s'). The logic Iw an t  to implementis the  f o ll o w ing :
Reading th re ads c a n readt he c o lle c tion simultan eously.
Whe n  Co ntrolth rea d  needto up da t e c ollection:
Con trol thre ad sho u ld nots tart th e upda teunt il a l lre adi ng thr e ad s t h atare curr en tl y wor king w i t h co lle ctio n com plete their w ork .
Bu t  at  thetimetheCo ntrol  threa d iswa iting for finis hing  readingthr ea ds,  o therr eading  th rea ds that  have n o t s ta r t e dto work with colle ct i o nyet, sho uld no t  s ta r t - they  s hou ld w a i t unt il C o nt rol thre ad upd a te  t he coll ec tion.
W hat  th reads sync hroniz ation te chniq u e should I use ? 

A:

just ta k ea lo o k  a t R eaderWriter Lock Clas s wh i ch   d e fines  a lo ck th a t supports single w ri ters a nd mu ltiple reader s or  youc a n  use Rea derW r it e rLockSlim (sup porte d in .Net4 .0) whic h ismore con venient i f you aresta rti nga n e w  d evelopment(fo r exam pl e  it a voi ds many  ca ses  of  po te ntial dea dlock)  fr om  M SDN : 

R e aderWrit er Loc kS lim  is s i milarto Re ader Wr it e rLo ck, but it h as s im pl ifie d r ul es fo r re c urs ion and  for upgr adi n g an ddo wngradi ng lock state .ReaderWrit er Loc kSlima v oids man y cases of potential de a dlock.Inaddit ion,  the perf orm ance o f R e aderWr iterLo ckSli miss i gnifi c a nt lybe tter thanR e ade rWrit er Lock . Reade rWriterLockSlim is rec ommended forall  new d ev elo p me n t.* 
A :
U s e the ReaderWri terLockSli mC la ss:

Repre s ent sa lockthat is  used to mana ge access  to a res ou rce,  al lowing mul tiple th reads for readi n gor ex clu sive a cc ess  forwritin g .
U se Re aderWr it erLock Slimto  protect  a resource that is rea d by
 mult ipl e threads  an d  wr itten toby o ne threadata t ime.  R e aderW rite r Lo ckS l im al lows multiplet hr ead s to  be in read m o de, 
  al low s  one t hrea d to be in writem ode with exclu sive o wne rsh i p of  t he
  lock, and  al lo w s  one thr ea d that hasread acc es s  to b e in u pgrade able
 r e ad mode,from  wh ich the t hre ad can upg ra de to wri te m od e with out
 h avin g to relinquish it s rea d acces s  to  there source. 
Joe  Albahari' s Threading  in C#  isa gre at reso ur ce.

Q:
k eep iterat i ng over a nd ov er OVER  a n ar ray 

I re aliz e my co mmun ic ati ng skills a re 
 temp->next;
_ }

}

_Q:

C# complex thread synchronization

I_have quite_complex_threads synchronization_case._I have a_collection which is_accessed from different threads._One thread, let's_name_it 'Control thread', updates a collection. Other threads read the collection ('Reading threads'). The_logic_I want_to_implement_is the following:

Reading threads can_read the collection simultaneously.
When Control_thread need_to update collection:

Control thread should not start the_update_until all reading_threads that are currently working with collection complete their_work.
But at the time the Control_thread is waiting_for_finishing_reading threads, other reading_threads that have not started to_work with collection yet, should not_start - they should wait until Control_thread update the collection.

What threads synchronization_technique should I use?

A:

just take_a look_ at ReaderWriterLock Class which_ defines a_lock that_supports single writers_and multiple readers or  you_can use ReaderWriterLockSlim_(supported in .Net 4.0) which is_more_convenient if you_are_starting_a new_development(for example _it_avoids many_cases_of potential deadlock)   
from_MSDN:_

ReaderWriterLockSlim is similar to ReaderWriterLock, but it_has simplified rules for_recursion_and for upgrading and_downgrading lock state. ReaderWriterLockSlim avoids_many cases of potential deadlock. In_addition, the_performance of_ReaderWriterLockSlim is significantly better than ReaderWriterLock. ReaderWriterLockSlim is recommended for all_new development.*

A:

Use the ReaderWriterLockSlim Class:

Represents a_lock that is used_to manage_access_to a resource,
__allowing multiple_threads for reading or exclusive access for_writing.
Use ReaderWriterLockSlim_to protect a resource that is_read by
  multiple_threads_and written to by one thread_at a time.
  ReaderWriterLockSlim allows_multiple threads to be in_read_mode,
_ allows one thread to_be in write mode with exclusive_ownership of the
_ lock, and allows one thread that_has_read access to be in upgradeable
__read mode, from which the thread_can_upgrade_to write mode without
 _having to relinquish its read access_to the resource.

Joe Albahari's Threading in C# is a_great resource.

 Q:

keep_iterating over and over OVER_an_array

I_realize my communicating skills are