|
-
January 28th, 2008, 12:53 PM
#1
Multi-threading Problem
Hi there,
I am executing a call to a function contained within a 3rd Party .dll and it is running extremely slowly when executed by a thread.
Calling the function using a single thread works fine, executing in 20ms as expected. When I create and execute two threads, the time for the function to execute is about 40-60 ms for each thread. It varies greatly but never close to 20ms.
Basically I have the following:
ThirdPartObject obj1 = new ThirdPartObject();
ThirdPartObject obj2 = new ThirdPartObject();
public void Run()
{
ThreadStart worker1 = delegate { RunObj1(); };
new Thread(worker1).Start();
ThreadStart worker2 = delegate { RunObj2(); };
new Thread(worker2).Start();
}
public void RunObj1()
{
this.obj1.Execute();
}
public void RunObj2()
{
this.obj2.Execute();
}
if I replace the code in RunObj1 and RunObj2 with say a for-loop which adds numbers, it behaves as expected and both RunObj1 and RunObj2 run in parallel.
Any ideas?
Thanks.
Last edited by kenjo; January 28th, 2008 at 12:55 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|