TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Koteswararao Mallisetti
NA
817
563.7k
how to solve the semaphore problem in threads see my situation
Sep 7 2010 7:14 AM
i am call this fillTxtLogFile methods from threads so one thread start and write the data on text box at the same time another thread is start do the same these 2 are collision how two avoid the collision see my code the common resource here is txtLogFile.Text how to use interlock in here
private void fillTxtLogFile()
{
MessageBox .Show ("thread call the method");
if (File.Exists(@"E:\emailLogfile.log"))
{
FileStream fs = new FileStream(@"E:\emailLogfile.log", FileMode.Open, FileAccess.Read);
StreamReader sw = new StreamReader(fs);
string txtLine = null;
//critical section begion
txtLogFile.Text = "";
while ((txtLine = sw.ReadLine()) != null)
{
//Interlocked.Increment(10);
txtLogFile.Text += txtLine;
}
sw.Close();
//end the critical section
}
else
txtLogFile.Text = "No text File is exist";
}
Reply
Answers (
0
)
use of polymorphism OOPs consept
Problem regarding data save and retrieve at page load