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. new Threads and MultiThreads

new Threads and MultiThreads

Scheduled Pinned Locked Moved C / C++ / MFC
performancetutorialquestion
2 Posts 2 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.
  • J Offline
    J Offline
    johnstonsk
    wrote on last edited by
    #1

    I am trying to create a multi threaded program. First I have the thread that the program initializes, but I need another. The second thread is needed to access memory that is on a PCI card. I am already able to open the card, but not quite sure how to create a new thread. What include will I be needing? thanks, Steven

    B 1 Reply Last reply
    0
    • J johnstonsk

      I am trying to create a multi threaded program. First I have the thread that the program initializes, but I need another. The second thread is needed to access memory that is on a PCI card. I am already able to open the card, but not quite sure how to create a new thread. What include will I be needing? thanks, Steven

      B Offline
      B Offline
      bond006
      wrote on last edited by
      #2

      That's quite simple! :) Try something like this: // ------------------------------------------------------ #include UINT threadID; unsigned WINAPI ThreadFunc(LPVOID param); void main() { CPCICard pPCICard = new CPCICard(); _beginthreadex(NULL,0,ThreadFunc,NULL /*that's the parameter for the ThreadFunc*/,0,&threadID); DoSomeWorkBlablabla(); delete pPCICard; } unsigned WINAPI ThreadFunc(LPVOID param) { DoSomeThreadWork(); RunningLoop(); return 0; } // --------------------------------------------------- I don't know whether I helped you or not, but when you call _beginthreadex the ThreadFunc function is called and then two threads running on the same time, doing different things. :) bond006

      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