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
Joe Saddigh
NA
3
2k
Threading...
Oct 11 2012 11:55 AM
Hi,
I have a multi threaded application that also makes use of autoreset events.
Background:
The application is being used as a web service so I am exposing certain methods. I have a simple test harness that I can use to call the various exposed methods.
Problem:
At some point I call a run function like so in ObjectA :-
public void Run()
{
Thread tPeformRun = new Thread(PerformRun);
tPeformRun.Name = "ThreadName";
tPeformRun.IsBackground = true;
tPeformRun.Start();
}
Where PerformRun looks something like this:
private void PerformRun()
{
do
{
switch (Type)
{
case 1:
FunctionA();
break;
case 2:
FunctionB();
break;
}
} while (Continue);
Somewhere within FunctionA or B - I will call WaitOne on a autoreset event. This will be so that I can wait for some user interaction via the test harness.
When the user interaction takes place I then call a different function "Loaded" (below) on ObjectA, which will call Set on the same autoreset event that I called WaitOne on previously.
internal void Loaded()
{
// Do stuff...
AutoReset.Set();
}
However, the function happens to get called on a different thread to the one that I newed earlier on in Run, therefore the application sits and waits forever.
Can somebody please offer some guidance as to how I should design this or a solution as I am not sure where to go next with this.
Thanks so much in advance.
Joe
Reply
Answers (
2
)
To know how many aspx pages in a project
Please suggest Reference and free download software on textile Production management