Threads

This is a discussion on Threads within the C++ Programming forums, part of the General Programming Boards category; Is there anyway to multithread in C++ without using a system specific library? Thanks !...

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    Threads

    Is there anyway to multithread in C++ without using a system specific library? Thanks !
    Do not make direct eye contact with me.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    If you think about it, threading must always be a function of the OS, therefore, no, there could never be a totally generic threading interface, since no 2 OS's implement it in the same way.

    That said, there are some more portable libraries than others. pThreads is available for many OS's with more, or less, compliance.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    Windows = threads.
    Linux = forks.
    so no, as said its totaly system specific

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by Iamien
    Windows = threads.
    Linux = forks.
    so no, as said its totaly system specific
    Linux = threads.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    pThreads is a C library. Boost (www.boost.org) also has a C++ threads library which is somewhat portable.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    126
    Windows = threads.
    Linux = forks.
    Hmmm, lemme clear that up for you. The fork() system call on UNIX machines is used to create a new process. I don't know how to create a new process on Windows machines( spawn(), maybe? ). Linux, being a POSIX OS, can use pthreads as well.

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> Boost also has a C++ threads library which is somewhat portable.

    On the one ocasion I tried this, (simply as a test to help someone else), it worked, but as the questioner had reported, I found I leaked memory with it.

    Depends really on how portable you want to be. The threading model on your chosen OS will always be better than a "portable" model because the portable model necessarily introduces comprimises that would not be necessary on a platform specific application.

    As an aside fork() != in process threads.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-17-2008, 12:28 PM
  2. Yet another n00b in pthreads ...
    By dimis in forum C++ Programming
    Replies: 14
    Last Post: 04-07-2008, 01:43 AM
  3. Classes and Threads
    By Halloko in forum Windows Programming
    Replies: 9
    Last Post: 10-23-2005, 06:27 AM
  4. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 03:39 PM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 04:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21