Threading [modified]
-
Whats wrong with the Threading statements which is no allowing me to create the Thread System::Threading::Thread *backgroundThread = new System::Threading::Thread (new System::Threading::ThreadStart (SocketConnection,0) ); backgroundThread.Start(); void TCPIP::SocketConnection() { } error C3364: 'System::Threading::ThreadStart' : invalid second argument for delegate constructor; needs to be a pointer to a member function How it should be rewritten. -- modified at 8:11 Tuesday 30th May, 2006
-
Whats wrong with the Threading statements which is no allowing me to create the Thread System::Threading::Thread *backgroundThread = new System::Threading::Thread (new System::Threading::ThreadStart (SocketConnection,0) ); backgroundThread.Start(); void TCPIP::SocketConnection() { } error C3364: 'System::Threading::ThreadStart' : invalid second argument for delegate constructor; needs to be a pointer to a member function How it should be rewritten. -- modified at 8:11 Tuesday 30th May, 2006
Hi, as far as i know it should be done like this in C++/CLI: System::Threading::Thread^ backgroundThread = gcnew System::Threading::Thread (gcnew System::Threading::ThreadStart(this, &TCPIP::SocketConnection)); The "this" pointer is not neccessarily needed but if you pass a nullptr instead, then you'll have to specify a static method. regards Tobias
-
Hi, as far as i know it should be done like this in C++/CLI: System::Threading::Thread^ backgroundThread = gcnew System::Threading::Thread (gcnew System::Threading::ThreadStart(this, &TCPIP::SocketConnection)); The "this" pointer is not neccessarily needed but if you pass a nullptr instead, then you'll have to specify a static method. regards Tobias
Seems it recetified that issue but i'm getting error 'void TCPIP::SocketConnection(void)' : cannot create a delegate handler for 'System::Threading::ThreadStart' from a non-member function or a member of an unmanaged class
-
Seems it recetified that issue but i'm getting error 'void TCPIP::SocketConnection(void)' : cannot create a delegate handler for 'System::Threading::ThreadStart' from a non-member function or a member of an unmanaged class
Put your function in a class: Create an instance of the object to employ it as a method of that instance, or make the method static.