CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2011
    Posts
    24

    Equivalent of "Thread" java in C++

    Hi All,

    I am new member , my name is Javin Paul.

    I have used Thread in java a lot but not used in C++ , can any one please guide me what is equivalent of java Thread in C++ ?


    Thanks
    Javin

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Equivalent of "Thread" java in C++

    std::thread isn't supported by any compilers yet, so in the mean time you can use boost::thread.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Equivalent of "Thread" java in C++

    MFC library also implements CWinThread class.
    If not using MFC, boost, or other library, it's no sweat to implement your own Thread class based on CreateThread Windows API function.

    I can presume that "Thread" you have mentioned in OP is part of a Java library/framework and not of Java language.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  4. #4
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: Equivalent of "Thread" java in C++

    "javinpaul" thread is something which is very OS specific , java abstracted the idea and made is part of the language construct within Java , however C++ is as basic you can get without getting OS specific . if you are looking for something which is OS neutral as in Java , then head over to QT

    as in
    http://qt.nokia.com , think of it as C++ which works across all platforms.

  5. #5
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Equivalent of "Thread" java in C++

    Be sure that every language, library or framework has OS-specific stuff behind.
    Once the question was posted in Visual C++ & C++ Programming > Multithreading forum, I can presume that desired target OS is Windows.
    IMO, if cross-platform is not a must, then choosing a third-party little cute "OS neutral" monster like Qt, is not a very brilliant solution.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  6. #6
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: Equivalent of "Thread" java in C++

    some people have spend so much time doing Micro**ft stuff they can't think beyond it , lets face it they are struggling with one OS , how would they comprehend 3 or 4 ,

    Maya 2011 from Autodesk responsible , top quality Hollywood animation and special effects was developed in QT for windows mac and Linux. It has produced web kit , now used by MAC in safari browser , over 20000 cross platform applications have used it , not to mention the KDE for linux is based on QT UI framework.

    Language is only the tools , it is neither good or bad , it your own effort and understanding

    QT has over 15 years of development and proven track record behind it , what they have achieved in term of language maturity is yet to be achieved by any C++ implementation including MS
    Last edited by aamir121a; February 7th, 2011 at 08:02 AM.

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Equivalent of "Thread" java in C++

    Quote Originally Posted by aamir121a View Post
    some people have spend so much time doing Micro**ft stuff they can't think beyond it , lets face it they are struggling with one OS , how would they comprehend 3 or 4 ,

    Maya 2011 ...
    When you are saying that some people are hooked in one OS and "can't think beyond it", then it's fair to say the same about the ones hooked in something like Qt.

    Just I have expressed one opinion in a Visual C++ forum, in a thread in which nobody asked about cross-platform.
    From my side, there was not any intention to argue and/or start a flame about how great are whatever concepts, technologies or companies.

    Pease respect my opnion, then I'll respect yours!
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured