Update of the build system

- Added a check if threads are working.
- Updated requirements for examples requiring threads.