#include
#include
#include
#include
#include
成都創(chuàng)新互聯(lián)2013年至今,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢想脫穎而出為使命,1280元綏化做網(wǎng)站,已為上家服務(wù),為綏化各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
#define NUM 2
void thread(void arg)
{
int i;
DIR dir = NULL;
struct dirent ptr = (struct dirent )calloc(1, sizeof(struct dirent));
struct dirent *result = NULL;
for (i=0;i<1;i++) {
printf ("in thread:%d\n", (int)arg);
dir = opendir("/root/tmp");
if (!dir) {
printf("opendir failed\n");
}
while ((readdir_r(dir, ptr, &result)==0) && (result != NULL)) {
printf("name:%s ", result->d_name);
}
printf ("\n");
closedir(dir);
sleep (1);
}
}
int main(void)
{
pthread_t id[NUM];
int i,ret;
for (i=0;i
}