Is there anyway to multithread in C++ without using a system specific library? Thanks !
Is there anyway to multithread in C++ without using a system specific library? Thanks !
Do not make direct eye contact with me.
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.
Windows = threads.
Linux = forks.
so no, as said its totaly system specific
Linux = threads.Originally posted by Iamien
Windows = threads.
Linux = forks.
so no, as said its totaly system specific
Quzah.
Hope is the first step on the road to disappointment.
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.
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.Windows = threads.
Linux = forks.
>>> 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.