代码如下: [html] view plain copy #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <semaphore.h> #define TEXT_SZ 1024 sem_t sem1; sem_t sem2; char text[TEXT_SZ];