|
| Author |
Message |
LithiumLi Special Member



 Joined: 30 Oct 2008 Posts: 210 Location: Bandar Seri Begawan, Bruinei
|
|
 |
Is there a way in a multi-thread app. (ofc there is a way -thus why im asking) to programatically have thread-B check what function thead-A is currently in?
-Li |
_________________
|
|
Date Posted:Mon Feb 09, 2009 6:19 pmThanks: 21Thanked 74 Times In 29 Posts
|
| Author |
Message |
qes27 Moderator



 Joined: 13 May 2007 Posts: 564 Location: Mpls, MN, USA
|
|
 |
Hmm .... good question.
Assuming you have a reference to thread A where thread B is running, you could try Thread.GetDomain() on that reference to thread A. The AppDomain object has many properties identifying the current code's location, but you'll have to breakpoint the code and check if the values it's returning are for thread A or thread B.
Other than that ... I'm not seeing much. I'm also wondering how that would work if thread A is currently running, since its location in code is changing. It could get weird if thread A's not in managed code at the time, too. |
|
|
Date Posted:Mon Feb 09, 2009 10:32 pmThanks: 42Thanked 119 Times In 88 Posts
|
| Author |
Message |
dougbenham Newbie

.jpg)

 Joined: 28 Oct 2008 Posts: 9
|
|
 |
You could also have some kind of flag that your application sets in each function.. Like so:
| Code: |
public enum Function
{
None,
main,
functionOne,
functionTwo
}
public Function flag = Function.None;
void main()
{
flag = Function.main;
// Do stuff
}
void functionOne()
{
flag = Function.functionOne;
// Do stuff
}
void functionTwo()
{
flag = Function.functionTwo;
// Do stuff
} |
Then you could have your separate thread access that global flag. |
|
|
Date Posted:Sun Feb 15, 2009 11:06 pmThanks: 0Thanked 2 Times In 2 Posts
|
Astalavista Forum Index :: Keygenning and Programming :: C# Function Awareness
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|