freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

嵌入式操作系統(tǒng)yms-閱讀頁

2025-07-22 13:51本頁面
  

【正文】 uffer is not empty */ pthread_cond_t notfull。/**//* Initialize a buffer */void init(struct prodcons * b) { pthread_mutex_init(amp。 pthread_cond_init(amp。 pthread_cond_init(amp。 breadpos = 0。}/**//* Store an integer in the buffer */void put(struct prodcons * b, int data) { pthread_mutex_lock(amp。 /* Wait until buffer is not full */ while ((bwritepos + 1) % BUFFER_SIZE == breadpos) { printf(wait for not full\n)。bnotfull, amp。 } /* Write the data and advance write pointer */ bbuffer[bwritepos] = data。 if (bwritepos = BUFFER_SIZE) bwritepos = 0。bnotempty)。block)。 pthread_mutex_lock(amp。 /* Wait until buffer is not empty */ while (bwritepos == breadpos) { printf(wait for not empty\n)。bnotempty, amp。 } /* Read the data and advance read pointer */ data = bbuffer[breadpos]。 if (breadpos = BUFFER_SIZE) breadpos = 0。bnotfull)。block)。}/**/define OVER (1)struct prodcons buffer。 for (n = 0。 n++) { printf( put%d\n, n)。buffer, n)。buffer, OVER)。 return NULL。 while (1) { d = get(amp。 if (d == OVER ) break。 } printf(consumer stopped!\n)。}/**/int main(void) { pthread_t th_a, th_b。 init(amp。 pthread_create(amp。 pthread_create(amp。 /* Wait until producer and consumer finish. */ pthread_join(th_a, amp。 pthread_join(th_b, amp。 return 0。客戶端向服務(wù)端發(fā)送信息,服務(wù)端接受信息并顯示。 struct sockaddr_in my_addr。 int sin_size。if(sockfd0) { printf(create socket failed!)。 =htons(MYPORT)。 bzero(amp。if(bind(sockfd,(struct sockaddr*)amp。 return。 return。 。 newfd=accept(sockfd,(struct sockaddr*)amp。sin_size)。 return。if(send(newfd,hello world!,14,0)0) { printf(send error!)。 return。}close(sockfd)。 }客戶端程序:includeincludeincludeincludeincludesys/includenetinet/includesys/includesys/define SERVER_PORT 4500define MAXDATASIZE 100int main(int argc,char**argv) {int sockfd,numbytes。struct sockaddr_in their_addr。return。if(sockfd0) {printf(create socket failed!)。=htons(SERVER_PORT)。(),8)。)==0) { printf(hello world!\n)。 } if(connect(sockfd,(struct sockaddr *)amp。 return。if(numbytes0) { printf(receive number failed!\n)。 }buf[numbytes]=39。printf(received:%s\n,buf)。}四、實(shí)驗(yàn)運(yùn)行及結(jié)果服務(wù)器端執(zhí)行 ./test82 結(jié)果:this is the server!客戶端執(zhí)行 ./test81 結(jié)果:received: hello wo
點(diǎn)擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1