Passing parameters to Thread function.
-
Hi, I am making one application in VC++.NET. I want to pass one integer parameter to one thread function. How can I pass parameter to thread functions? My code is as below.
Thread function
public class TestThread
{
public:
static void ThreadProc()
{
...
}
};Thread function call
Thread* myThread = new Thread(new ThreadStart(&TestThread::ThreadProc));
myThread->Start();I want to pass one integer parameter in
ThreadProc()
. Thanks in Advance Priyank Raval -
Hi, I am making one application in VC++.NET. I want to pass one integer parameter to one thread function. How can I pass parameter to thread functions? My code is as below.
Thread function
public class TestThread
{
public:
static void ThreadProc()
{
...
}
};Thread function call
Thread* myThread = new Thread(new ThreadStart(&TestThread::ThreadProc));
myThread->Start();I want to pass one integer parameter in
ThreadProc()
. Thanks in Advance Priyank Raval -
Hi, I am making one application in VC++.NET. I want to pass one integer parameter to one thread function. How can I pass parameter to thread functions? My code is as below.
Thread function
public class TestThread
{
public:
static void ThreadProc()
{
...
}
};Thread function call
Thread* myThread = new Thread(new ThreadStart(&TestThread::ThreadProc));
myThread->Start();I want to pass one integer parameter in
ThreadProc()
. Thanks in Advance Priyank RavalGlobal variable?? NO! :) This is C++! Derive a class from Thread and you can make whatever constructor and add whatever member variables you want :) *EDIT ack it's sealed Mark -- modified at 13:05 Monday 11th June, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Hi, I am making one application in VC++.NET. I want to pass one integer parameter to one thread function. How can I pass parameter to thread functions? My code is as below.
Thread function
public class TestThread
{
public:
static void ThreadProc()
{
...
}
};Thread function call
Thread* myThread = new Thread(new ThreadStart(&TestThread::ThreadProc));
myThread->Start();I want to pass one integer parameter in
ThreadProc()
. Thanks in Advance Priyank RavalI still stand by my "this is C++ response :) I thought Nish would have this covered... How to pass data to worker threads[^] Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Hi, I am making one application in VC++.NET. I want to pass one integer parameter to one thread function. How can I pass parameter to thread functions? My code is as below.
Thread function
public class TestThread
{
public:
static void ThreadProc()
{
...
}
};Thread function call
Thread* myThread = new Thread(new ThreadStart(&TestThread::ThreadProc));
myThread->Start();I want to pass one integer parameter in
ThreadProc()
. Thanks in Advance Priyank Ravalhi priyank please ask vc.net related question here[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You