Multithreading in C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Man4ish
    New Member
    • Mar 2008
    • 151

    Multithreading in C++

    I am C++ programmer and planning to learn multithreading. Can some one please tell me some link for beginners in multi threading in C++. I found many link on net but all looks going over my head. Thanks in advance.
  • Jajjo
    New Member
    • May 2009
    • 26

    #2
    I hear the Boost library is good.

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      Since multi-threading is platform dependent you are going to need to tell us what platform you are using or which multi-pltform 3rd party library (such as boost but others exist) you are using.

      In general multi-threading is relatively simple, you call a library function that starts another thread of execution using a user provided function as the entry-point for the new thread of execution, in the same way that main is the entry point for the original thread of execution (unless you have been looking at fork which works slightly differently and it you have I suggest you look up pthreads instead for now).

      You put your code for the new thread in the user provided function. The complexities come when you need to synchronise running between the original thread and the new thread or if both threads want to access data at the same time, which they mustn't do. You can use mutex and semaphore objects to handle this synchronisation issue.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        If you are using Windows you must get a copy of Windows via C/C++ by Jeffrey Richter at once. Everything you need to know plus sample code is in there.

        Comment

        Working...