Click here to Skip to main content
15,907,001 members
Home / Discussions / C#
   

C#

 
AnswerRe: Regarding look of window forms controls.... Pin
Johnny J.26-May-10 21:04
professionalJohnny J.26-May-10 21:04 
AnswerRe: Regarding look of window forms controls.... Pin
Johnny J.26-May-10 22:30
professionalJohnny J.26-May-10 22:30 
GeneralRe: Regarding look of window forms controls.... Pin
jainiraj26-May-10 22:36
jainiraj26-May-10 22:36 
QuestionZip/Unzip Pin
jojoba201126-May-10 17:21
jojoba201126-May-10 17:21 
AnswerRe: Zip/Unzip Pin
Luc Pattyn26-May-10 17:42
sitebuilderLuc Pattyn26-May-10 17:42 
GeneralRe: Zip/Unzip Pin
Bernhard Hiller26-May-10 23:20
Bernhard Hiller26-May-10 23:20 
GeneralRe: Zip/Unzip Pin
Luc Pattyn27-May-10 3:15
sitebuilderLuc Pattyn27-May-10 3:15 
QuestionProblem in use Of ReaderWriterLockSlim Class Pin
shahramkeyboard26-May-10 11:14
shahramkeyboard26-May-10 11:14 
hi my code is:
        static ReaderWriterLockSlim rw = new ReaderWriterLockSlim();
        static Random rand = new Random();

        Thread[] AThreadReader, AThreadWriter;
        Thread ThreadReaderCreator;
        string sDataBase;
        Boolean bWriterMustAlive;
        string[] asReaderDataBase = new string[10];        

private void btnRun_Click(object sender, EventArgs e)
        {
            AThreadWriter = new Thread[Int16.Parse(txtBNMWriters.Text)];
            bWriterMustAlive = true;
            for (int i = 0; i < Int16.Parse(txtBNMWriters.Text); i++)
            {
                AThreadWriter[i] = new Thread(fThreadWriter);
                AThreadWriter[i].Name = i.ToString();
                AThreadWriter[i].IsBackground = true;
                AThreadWriter[i].Start();
            }
            ThreadReaderCreator = new Thread(fThreadCreator);
            ThreadReaderCreator.IsBackground = true;
            ThreadReaderCreator.Start();
        }

        void fThreadCreator()
        {
            Random r = new Random();
            AThreadReader = new Thread[Int16.Parse(txtBNMReaders.Text)];
            for (int i = 0; i < Int16.Parse(txtBNMReaders.Text); i++)
            {
                int IloopLength = Int16.Parse(txtBLowerBCReaders.Text) + r.Next(Int16.Parse(txtBUpperBCReaders.Text) - Int16.Parse(txtBLowerBCReaders.Text));
                for (int j = 0; j < IloopLength; j++) ;                
                AThreadReader[i] = new Thread(fThreadReader);
                AThreadReader[i].Name = i.ToString();
                AThreadReader[i].IsBackground = true;
                AThreadReader[i].Start();
            }
        }

        void fThreadWriter()
        {

            Random r = new Random();
            int ID = Int16.Parse(Thread.CurrentThread.Name);
            int news = ID;
            while (bWriterMustAlive)
            {
                int IloopLength = Int16.Parse(txtBLowerBCWriters.Text) + r.Next(Int16.Parse(txtBUpperBCWriters.Text) - Int16.Parse(txtBLowerBCReaders.Text));
                for (int i = 0; i < IloopLength; i++) ;
                
                sDataBase = "";
                for (int i = 0; i < Int16.Parse(txtBNumbersInString.Text); i++)
                {
                    while (true)
                    {
                    rw.EnterWriteLock();
                    sDataBase += news.ToString() + " ";
                    rw.ExitWriteLock();
                    }
                }
                
                news += Int16.Parse(txtBNMWriters.Text);
            }
        }
        void fThreadReader()
        {

            int ID = Int16.Parse(Thread.CurrentThread.Name);
            changeAmountOfProgressBar(ID+1);
            
            for (int i = 0; i < sDataBase.Length; i++)
            {

                  asReaderDataBase[ID] += sDataBase[i];

            }

            if (ID == Int16.Parse(txtBNMReaders.Text) - 1)
            {
                bWriterMustAlive = false;

            }

        }

but I can,t Slove Readers Writers Problem
what is the Prblem?Confused | :confused:
AnswerRe: Problem in use Of ReaderWriterLockSlim Class Pin
Henry Minute26-May-10 11:43
Henry Minute26-May-10 11:43 
AnswerRe: Problem in use Of ReaderWriterLockSlim Class Pin
William Winner26-May-10 12:22
William Winner26-May-10 12:22 
AnswerRe: Problem in use Of ReaderWriterLockSlim Class Pin
Pete O'Hanlon26-May-10 12:38
mvePete O'Hanlon26-May-10 12:38 
QuestionButton Long Click Pin
Eli Nurman26-May-10 7:25
Eli Nurman26-May-10 7:25 
AnswerRe: Button Long Click Pin
DaveyM6926-May-10 7:41
professionalDaveyM6926-May-10 7:41 
GeneralRe: Button Long Click Pin
Eli Nurman26-May-10 7:42
Eli Nurman26-May-10 7:42 
GeneralRe: Button Long Click Pin
T M Gray26-May-10 7:53
T M Gray26-May-10 7:53 
GeneralRe: Button Long Click Pin
Kevin Marois26-May-10 10:46
professionalKevin Marois26-May-10 10:46 
AnswerRe: Button Long Click Pin
AspDotNetDev26-May-10 8:12
protectorAspDotNetDev26-May-10 8:12 
AnswerRe: Button Long Click Pin
AspDotNetDev26-May-10 8:16
protectorAspDotNetDev26-May-10 8:16 
GeneralRe: Button Long Click Pin
#realJSOP26-May-10 8:31
professional#realJSOP26-May-10 8:31 
AnswerRe: Button Long Click Pin
William Winner26-May-10 9:56
William Winner26-May-10 9:56 
AnswerRe: Button Long Click Pin
Ravi Bhavnani26-May-10 15:16
professionalRavi Bhavnani26-May-10 15:16 
AnswerRe: Button Long Click Pin
Eli Nurman27-May-10 6:15
Eli Nurman27-May-10 6:15 
QuestionIdentify non-physical ethernet adapter Pin
Sunil P V26-May-10 5:44
Sunil P V26-May-10 5:44 
AnswerRe: Identify non-physical ethernet adapter Pin
#realJSOP26-May-10 7:04
professional#realJSOP26-May-10 7:04 
GeneralRe: Identify non-physical ethernet adapter Pin
Henry Minute26-May-10 11:47
Henry Minute26-May-10 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.