Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Threading [modified]

Threading [modified]

Scheduled Pinned Locked Moved Managed C++/CLI
help
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    satsumatable
    wrote on last edited by
    #1

    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

    2 1 Reply Last reply
    0
    • S satsumatable

      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

      2 Offline
      2 Offline
      2bee
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • 2 2bee

        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

        S Offline
        S Offline
        satsumatable
        wrote on last edited by
        #3

        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

        G 1 Reply Last reply
        0
        • S satsumatable

          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

          G Offline
          G Offline
          George L Jackson
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups