Threads

Simple example programs using threads, mutex and logging:

Threads with POSIX:

http://en.wikipedia.org/wiki/POSIX_Threads

Start and run with:

$ g++ -Wall -O3 pthreads.cpp -o pthreads -lpthread; ./pthreads

+ simple, join() exists

- runs only under POSIX OS

Threads with Qt:

http://doc.qt.io/qt-5/qthreadpool.html

Start and run with:

$ tar -xzf qthreads.tar.gz

$ cd qthreads/

$ qmake; make; ./qthreads

+ runs under OS which have Qt, signal & slot capable

- join() is called wait()

Threads with Boost:

http://www.boost.org/doc/libs/1_44_0/doc/html/thread.html

Start and run with:

$ g++ -Wall -O3 bthreads.cpp -o bthreads -lboost_thread-mt; ./bthreads

+ runs under OS which have boost, elaborate, join() exists

- constructor starts the thread

Update: Boost threads are now handled with thread_group (Thanks, João!).

Update2: Qt threads are handled by QThreadpool now (Again thanks, João!).