#include #include const int THREADS = 4; /* the function called for each thread */ void* f(void* data) { std::cout << "Hello from a thread!" << std::endl; pthread_exit(NULL); } int main() { /* an array of threads */ pthread_t threads[THREADS]; for (int t = 0; t < THREADS; t++) { pthread_create(&threads[t], NULL, f, NULL); } pthread_exit(NULL); }