C# Function Awareness
Astalavista Forum Index :: Keygenning and Programming :: C# Function Awareness
Post new topic   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
  C# Function Awareness
Author Message
LithiumLi
Special Member
Special Member


Offline
No Image
Joined: 30 Oct 2008
Posts: 210
Location: Bandar Seri Begawan, Bruinei

Reply with quote
No Image
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

_________________
Need insight/help on unpacking? Here's an eBook for you! http://www.astatalk.com/viewtopic.php?t=236702
Learning Assembly? Here's an eBook for you!
http://www.astatalk.com/viewtopic.php?p=1050410
Need some stock photos of models? Male & Female! Go here:
http://astatalk.com/viewtopic.php?t=265415
View user's profile Send private message
PostDate Posted:Mon Feb 09, 2009 6:19 pm
Thanks: 21Thanked 74 Times In 29 Posts

Author Message
qes27
Moderator
Moderator


Offline
No Image
Joined: 13 May 2007
Posts: 564
Location: Mpls, MN, USA

Reply with quote
No Image
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.
View user's profile Send private message
PostDate Posted:Mon Feb 09, 2009 10:32 pm
Thanks: 42Thanked 119 Times In 88 Posts

Author Message
dougbenham
Newbie
Newbie


Offline
No Image
Joined: 28 Oct 2008
Posts: 9

Reply with quote
No Image
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.
View user's profile Send private message
PostDate Posted:Sun Feb 15, 2009 11:06 pm
Thanks: 0Thanked 2 Times In 2 Posts

Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Page 1 of 1 All times are GMT


Back to top


 
Astalavista Forum Index :: Keygenning and Programming :: C# Function Awareness



Search This Topic:
Jump to:  
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


Powered by Astalavista.MS Team © 2004
Image Here Image Here Image Here