| 30 | volatile int started; |
| 31 | |
| 32 | int libc_ex3() |
| 33 | { |
| 34 | int i; |
| 35 | int pid; |
| 36 | |
| 37 | /* create a number to search for */ |
| 38 | pid = getpid(); |
| 39 | printf("Searching for the number = %d...\n", pid); |
| 40 | |
| 41 | /* Initialize the mutex lock */ |
| 42 | pthread_mutex_init(&lock, NULL); |
| 43 | |
| 44 | /* Create the searching threads */ |
| 45 | for (started=0; started<NUM_THREADS; started++) |
| 46 | pthread_create(&threads[started], NULL, search, (void *)pid); |
| 47 | |
| 48 | /* Wait for (join) all the searching threads */ |
| 49 | for (i=0; i<NUM_THREADS; i++) |
| 50 | pthread_join(threads[i], NULL); |
| 51 | |
| 52 | printf("It took %d tries to find the number.\n", tries); |
| 53 | |
| 54 | /* Exit the program */ |
| 55 | return 0; |
| 56 | } |
| 57 | #include <finsh.h> |
| 58 | FINSH_FUNCTION_EXPORT(libc_ex3, example 5 for libc); |
| 59 |
nothing calls this directly
no test coverage detected