IPC pthread_rwlock_t

来源:互联网 发布:著名网络武侠小说家 编辑:程序博客网 时间:2024/06/16 09:00
#include #include #include #include #include #include #include int main(int argc ,char * argv[]){ pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER ;char arg; while( (arg =getopt(argc,argv,"rw"))!= -1){ switch(arg){ case 'r': printf("r/n"); break; case 'w': printf("w/n"); break; } }编译时必须采用如下的格式,否则提示pthread_rwlock_t 没有定义 gcc -o rwlock rwlock.c -D_XOPEN_SOURCE=500 -Wall
原创粉丝点击