0
Reply

Threading.Monitor <>

Honey HooO

Honey HooO

Jul 6 2007 10:48 AM
2k
Lovely HelloO! I`m in a force major project! Would you help me please? My project is a Multi threading synchronization that must be implement System.Threading.Monitor Class The Scenario: [ There is two thread, Reader and Writer that works together on a shared resource (a field of a table in a DB) 1) If there are many readers without any writers, so readers must read from resource together 2) If there are many writers without any readers, so writers must write into resource consecutive 3) If there are many readers and writers, so writers and readers must work ALTERNATE. First a writer write and then a reader read, next writer, next reader and so on ] How can i implement this scenario with Monitor? I searched and read all methods and members of monitor class but i don`t have any experience in Multi threading or Thread Synchronize! I know that i can lock an object by Monitor.Enter(); ... ... ... Monitor.Exit(); but my problem is to synchronize reader and writers alternate, and 1 and 2. Would you help me please???