}pthread_rwlock_wrlock(&config_rwlock);for(co = config_root; co ; co = co->next) {if(strcmp(co->name,"global") ==0||strcmp(co->name,"plugins") ==0) pri =0;elseif(strncmp(co->name,"plugin:",7) ==0) pri =1;elsepri =2;if(i == pri) {intused =0;intchanged =0;int...
pthread_rwlock_unlock 示例代码: #include <pthread.h>#include<stdio.h>#include<unistd.h>staticintcounter;staticpthread_rwlock_t rwlock;void*th_write(void*arg) {intt, i;for(i=0; i<5; i++) { pthread_rwlock_wrlock(&rwlock); t=counter; usleep(100); printf("Write Thread(%x) counter=%d...
r = pthread_rwlock_init(&rwlock,NULL); assert(r ==0);fprintf(stderr,"Locking rwlock via pthread_rwlock_wrlock().\n"); r = pthread_rwlock_wrlock(&rwlock); assert(r ==0); r = pthread_rwlock_unlock(&rwlock); assert(r ==0);fprintf(stderr,"Locking rwlock viapthread_rwlock_trywrlock...