troubleshooting Question

pass the method from c++ to C# for ThreadPool.QueueUserWorkItem

Avatar of srinathchow
srinathchowFlag for United States of America asked on
C#Visual C++.NETEditors IDEs
3 Comments1 Solution472 ViewsLast Modified:
Hi I am trying to something like

I have a method called process written in c++. and trying to do ThreadPool.QueueUserWorkItem(process) in C#. This ThreadPool.QueueWorkItem is defined in C# in the constructor in a class

So, I got the instance of that class in c++ and trying to pass the c++ method to the C# file for Threadpool.

Any help is greatly appreciated! Thanks a lot!
Example Code:
 
C# code:
public delegate void Process();
public class ThreadClass
{
//Constructor
public ThreadClass(Process del,string x)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(0,del), x);
}
}
 
c++ code:
int main(array<System::String ^> ^args)
{
string x = "something";
//when the below call is made the prcess must be queusd for work
ThreadClass(&process,x);
}
 
static void process()
{
// do something
}
ASKER CERTIFIED SOLUTION
Omego2K

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros