54; int bg_val = 42; pthread_t bg_thread; // Create the background thread if (pthread_create(&bg_thread, NULL, bg_func, &bg_val)) { perror("Thread create failed"); return 1; } // Calculate on the foreground thread fg_val = fibonacci(fg_val); // Wait for background thread to finish if (pthread_join(bg_thread, NULL)) { perror("Thread join failed"); return 2; } // Show the result from background and foreground threads printf("Fib(42) is %d, Fib(54) is %d\n", bg_val, fg_val); return 0; }