does MethodInvoker will not work on win XP?
-
I have a method something like this.
private void PrintSomething()
{
//some code here
}then calling this method like this
MethodInvoker mi = new MethodInvoker(PrintSomething);
mi.BeginInvoke(null, null);This will work pretty well on win7 and up, but if running it on Win XP will cause a very high cpu usage and will it eat up the memory then the desktop will freeze. but just calling the method synchronously everything is fine under win XP.
private void btn_click(object sender, EventArgs e)
{
PrintSomething();
}Any thought about this? I will appreciate for any advice will. Thanks.
-
I have a method something like this.
private void PrintSomething()
{
//some code here
}then calling this method like this
MethodInvoker mi = new MethodInvoker(PrintSomething);
mi.BeginInvoke(null, null);This will work pretty well on win7 and up, but if running it on Win XP will cause a very high cpu usage and will it eat up the memory then the desktop will freeze. but just calling the method synchronously everything is fine under win XP.
private void btn_click(object sender, EventArgs e)
{
PrintSomething();
}Any thought about this? I will appreciate for any advice will. Thanks.
Suggestions: 1. Try debugging it. Or it's not possible? 2. If not debugging, do some logging within the PrintSomething method. By what you're saying, it looks like you might end up calling
PrintSomething
method too many times 3. You can also ask ifIsInvokeRequired
first. 4. A profiler? (dotTrace comes to mind) Best, John-- Log Wizard - a Log Viewer that is easy and fun to use!
-
I have a method something like this.
private void PrintSomething()
{
//some code here
}then calling this method like this
MethodInvoker mi = new MethodInvoker(PrintSomething);
mi.BeginInvoke(null, null);This will work pretty well on win7 and up, but if running it on Win XP will cause a very high cpu usage and will it eat up the memory then the desktop will freeze. but just calling the method synchronously everything is fine under win XP.
private void btn_click(object sender, EventArgs e)
{
PrintSomething();
}Any thought about this? I will appreciate for any advice will. Thanks.
-
Suggestions: 1. Try debugging it. Or it's not possible? 2. If not debugging, do some logging within the PrintSomething method. By what you're saying, it looks like you might end up calling
PrintSomething
method too many times 3. You can also ask ifIsInvokeRequired
first. 4. A profiler? (dotTrace comes to mind) Best, John-- Log Wizard - a Log Viewer that is easy and fun to use!
Thanks for the advice, but I was end up not using asynchronous method execution if the OS is windows XP, :( it is hard to deal with some user that cant get over to their OS's and hardware.
-
mi.BeginInvoke(null, null) executes your PrintSomething() method asynchronously on a threadpool thread. Is that what you intended or did you mean to use Control.BeginInvoke(mi) to execute PrintSomething on the UI thread?
Yeah i just want to execute it asynchronously, but i was end up using synchronous if it detects that the OS is XP. BTW Thanks