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. C / C++ / MFC
  4. Passing parameters to Thread function.

Passing parameters to Thread function.

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++
5 Posts 4 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.
  • P Offline
    P Offline
    priyank_ldce
    wrote on last edited by
    #1

    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

    K M T 4 Replies Last reply
    0
    • P priyank_ldce

      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

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      a global variable could to the job. Or has the ThreatStart-class overloaded constructors?

      Greetings from Germany

      1 Reply Last reply
      0
      • P priyank_ldce

        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

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        Global 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

        1 Reply Last reply
        0
        • P priyank_ldce

          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

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          I 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

          1 Reply Last reply
          0
          • P priyank_ldce

            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

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #5

            hi 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

            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