sleep(2); //讓threadA能先執(zhí)行 pthread_mutex_lock(&lock); printf("thread B got the lock! a=%d b=%d\n", a, b); pthread_mutex_unlock(&lock); printf("thread B released the lock!\n", a, b); } int main() { pthread_t tida, tidb, tidc; pthread_mutex_init(&lock, NULL); p...
www.dbjr.com.cn/article/460...htm 2025-6-5